From: transfire@... Date: 2006-06-11T15:09:51+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Yukihiro Matsumoto wrote: > But I am still not sure if we need to provide the way to inject module > methods to a class's singleton class at the same time instance methods > are inherited to the class. Could somebody elaborate? It seems that > having two separate modules (one to include for instance methods and > another to extend for class methods) is more natural for me. I think the clearest use is with DSLs that also has useful instance methods. Currently DSLs of this sort can only be provided via subclasses. As you say, you can split it into two modules but if the methods go together inextrobaly, then this is very inconvenient --and unacceptably so when building frameworks and asking others to make use of such tools. But sometimes it goes beyond mere inconvenience b/c an instance method might call on a class method. The most basic example of this kind of inter-relationship looks like this: module M class << self attr_accessor :foo end def foo self.class.foo end end class X self << M end It's a class level setting, but with a way to easily access it from the instance level. To split this up into two modules is clearly a forced concession. module Mc attr_accessor :foo end module Mi def foo self.class.foo end end class X extend Mc include Mi end T.