From: MonkeeSage Date: 2007-12-18T03:50:07+09:00 Subject: Re: Constant Resolution Confusion On Dec 17, 12:07 pm, Phrogz wrote: > I was surprised by the following this weekend: > > module Foo > module Bar; end > class Whee1 > include Bar > end > end > # All is well > > class Foo::Whee2 > include Bar > end > #=> uninitialized constant Foo::Whee2::Bar (NameError) > > Is the answer simply "lexically scoped resolution"? > > Is the above still the case with 1.9? Maybe it's because (I assume) this is a paired-down example, but in the example class Whee1 is in the scope of module Foo, and so is module Bar, but module Bar isn't in the scope of class Foo::Whee2, so you have to include it as qualified Foo::Bar. It doesn't look like module Bar is lexically scoped to class Foo. Regards, Jordan