From: Intransition Date: 2011-06-09T00:27:06+09:00 Subject: Re: a little challenge - reproduce this error On Jun 8, 10:56 am, Christopher Dicely wrote: > > The top-level X (and the Foo underneath it) seems required to get the > error, so that doesn't make it harder. If you reference X::Foo::X > without X existing, you'll get > uninitialized constant Object::X (NameError) > > If you reference X::Foo::X with just the part you have above, you'll > get uninitialized constant X::Foo (NameError) > > The easiest way to get the error you ask about is > module X; module Foo; end; end > X::Foo::X Well, Balls. That in itself seems ridiculous, but you are right. I'm not sure why it raises that though. Maybe the code is silly, but is it really wrong? Try X::Foo.const_get(:X) and it works fine. Seems inconsistent, doesn't it? > But I would guess that that probably isn't what you are looking for either. Yes, in the actual code X is being referenced from within Foo but is not fully qualified.