Hi,

In message "Re: Why the lack of mixing-in support for Class methods?"
    on Sun, 11 Jun 2006 15:09:51 +0900, transfire / gmail.com writes:

|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.

I still have difficulties to imagine the concrete situation.

|  module M
|    class << self
|      attr_accessor :foo
|    end
|    def foo
|      self.class.foo
|    end
|  end

Do we have to allow M.foo?  I fell like you need to a way to add class
methods and instance methods at once, but it doesn't have to (or maybe
it shouldn't) be module methods inclusion.

|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

If you don't need M.foo and M.foo= in above example (while you
definitely need X.foo and X.foo=), Mc and Mi solution is the way to
go.  Redundancy can be removed by some kind of meta programming.

							matz.