Hello,

In preparing a talk about constants in Ruby and constant autoloading
in Rails, I am checking several books and docs, but there are some
things I have not been able to find. I have some hypothesis about how
things work based on tests I've done, but I'd be grateful if someone
could confirm them to be 100% certain that what I say is correct (or
it is not!).

* Constant lookup starts at Module.nesting[0] (or Object if nesting is
empty), is it true that a non-qualified (bare) constant gets also
defined always in Module.nesting[0] (or Object)?

* Is Module.nesting[0] (or Object if there's no nesting) what's known
as cref in MRI terminology?

* Is it true that blocks *never* change the nesting? In particular the
blocks passed to Class.new, module_eval, or instance_eval do not seem
to do it.

* Is it correct that class << self pushes the singleton class to the nesting?

* Is it true that module_eval STRING pushes the target class or module
to the current nesting thus being different from class_eval BLOCK in
this sense? In particular, if that's correct, nesting does not always
contain enclosing namespaces because of that.

* Similarly, is it true that instance_eval STRING pushes the singleton
class of the target to the current nesting?

* Ruby does not even compile a program with a constant defined in a
method. Which is the rationale for disallowing this? Are there other
places where constant definition is forbidden?

Thanks!