From: "Brian Schröder" Date: 2004-10-18T08:02:55+09:00 Subject: Re: include semantics broken? Bob Sidebotham wrote: > This seems very odd to me: > > module A > module B > end > end > > module X > include A > module Y > B # => uninitialized constant X::Y::B (NameError > end > end > > If I move the "include A" either up one line (before "module X"), or > down one line (after "module Y"), then it works as expected. Since > include is supposed to import all the constants from one module to the > other, then surely this should make the constants of A available to > anything defined within X? > > My intent, in doing this, is to include A's semantics only where they > are relevant... > > This may or may not be the way it's supposed to work--but for me, it > does violate POLS. > > Puzzled, > Bob Sidebotham > You can tell ruby to start from the "root"-namespace by prefixing with a ::. See below: module A module B end end module X include A module Y ::A::B # => uninitialized constant X::Y::B (NameError end end Regards, Brian -- Brian Schr�der http://ruby.brian-schroeder.de/