From: Joel VanderWerf Date: 2004-09-15T07:34:31+09:00 Subject: Re: Modules as namespaces Sam Stephenson wrote: > On Wed, 15 Sep 2004 06:34:01 +0900, Joel VanderWerf > wrote: > >>You need to make foo a module method of B: >>| module A >>| module B >> def B::foo; @foo; end >>| end >>| end >>The way you had it originally, you were defining an _instance_ method of >>B. If you had included B in some class, you could then call foo as an >>method of instances of that class. > > > Okay, I see. But now Foo#bar gives nil. > > So mixing in a module doesn't mix-in other modules "inside it" in the same way? Nope. The namespace containment hierarchy is different from the inheritance hierarchy.