From: "Iñaki Baz Castillo" Date: 2011-07-29T18:27:02+09:00 Subject: class variables in modules, annoying Hi, let me show the following code: -------------------------- module M @@var="M" def var @@var end def self.var @@var end end class A include M def var= v @@var=v end end a=A.new a.var => "M" a.var="A" => "A" M.var => "A" -------------------------- WHY is @@var replaced within M module? I do know that this behaviour exists when inheriting classes, so a children class shares the class variables of its parent class (which is a documented but undesirable feature of Ruby). But I didn't expect it to occur using a module as I'm not inheriting from a class. In short, don't use class variables within a module, am I right? Thanks a lot. -- Iñaki Baz Castillo