From: Christoph Rippel Date: 2000-12-20T05:55:27+09:00 Subject: [ruby-talk:7715] Re: (Maybe) a correction for Programming Ruby -----Original Message----- From: dave@thomases.com [mailto:dave@thomases.com]On Behalf Of Dave Thomas Sent: Tuesday, December 19, 2000 12:14 PM To: ruby-talk ML Subject: [ruby-talk:7710] Re: (Maybe) a correction for Programming Ruby > When this module is included in another, Ruby calls > \METHOD{append\_features} in this module, passing it the > receiving module in \obj{aModule}. Ruby's default implementation > is to add the constants, methods, and module variables of this > module to \obj{aModule} if this module has not already been > added to \obj{aModule} or one of its ancestors. See also... I think this is fine except that Matz seems to have implemented ``instance module variables'' versus 'Module variables' (see below). You did not fully describe these concepts in your book (as far as I know) so it's probably okay (and too late for now) - well maybe it should be ... if this module has not already been included in \obj{aModule} or one of its ancestors ... - but I have no strong opinions about this. Christoph module Mod @inst # we could use attr. @@mod = "m" def ins @ins end def mod @@mod end end class A include Mod def initialize @ins = "a" end end class B include Mod def initialize @ins = "b" end end a = A.new b = B.new a.ins == b.ins # false a.mod == b.mod # true