On 6/13/06, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Why the lack of mixing-in support for Class methods?"
>     on Wed, 14 Jun 2006 13:36:34 +0900, transfire / gmail.com writes:
>
> |So if you did this, would #include handle the extending? Or would
> |another method need to be used?
>
> I thinking of something like the following:
>
>   module Moo
>     def im
>     end
>
>     class_extension do

Maybe it could be called class_methods ?

>       def cm
>       end
>     end
>   end
>
>   class Foo
>     include Foo
>   end
>   foo = Foo.new
>   foo.im
>   Foo.im

Do you mean Foo.cm ?

> The name 'class_extension' may be changed in the real implementation,
> or maybe it would be a new visibility.
>

Is this just a more automatic/nicer way to do:

module Moo
   def self.included mod
      mod.extend ClassMethods
   end
   module ClassMethods
     def cm
     end
   end
   def im
   end
end

class Foo
  include Moo
end

?

It does seem a bit more convenient.

Phil