Re: module MyMod::MyOtherMod question



Gene Angelo wrote:
Gene Angelo wrote:
[I] assumed these were synonymous, but they are not:

I stand corrected. It appears that in order to use the following syntax:

module A::B
...
end

module A must be defined.

Yes. But even then,

module A; end
module A::B
...
end

is different to

module A
module B
...
end
end

in the way that constants are looked up.


module A; FOO = 123; end
=> 123
module A::B
puts FOO
end
NameError: uninitialized constant A::B::FOO
from (irb):3
from :0
module A; module B
puts FOO
end; end
123
=> nil
--
Posted via http://www.ruby-forum.com/.

.