From: John Mair Date: 2010-10-07T08:33:35+09:00 Subject: Why does Module#include exclude the module's metaclass? When classes are inherited in Ruby the singleton classes are also inherited: class A def self.hello puts "hello" end end class B < A end B.hello #=> "hello" Yet with modules, this is not the case: module M def self.goodbye puts "goodbye" end end class A include M end A.goodbye #=> NameError To get around this limitation many ppl resort to this ugly hack: module M def self.included(c) c.extend ClassMethods end module ClassMethods def goodbye puts "goodbye" end end end Ok, so my question: is there a theoretical/conceptual reason behind this limitation on modules? or was it just an implementation difficulty? After looking at the C source code (YARV/MRI) I can identify there is an implementation difficulty (not insurmountable, but one all the same), but is this the sole reason? Are there any other reasons for this limitation? thanks -- Posted via http://www.ruby-forum.com/.