From: Carlos Date: 2006-06-16T20:02:31+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Why the lack of mixing-in support for Class methods?" > on Fri, 16 Jun 2006 18:56:23 +0900, dblack@wobblini.net writes: > > |> class C > |> include M > |> end > |> M.a = 42 > |> p M.a # => 42 > | > |Will this happen if the module is included in another module? If so, > |I'm wondering whether a more generic name, without "class" in it, > |could be used instead of "class_extension". > > That's where I am wondering. Using the Daniel's code: > > module M > class_extension do > def foo > end > end > end > module M2 > include M > end > class C > include M2 > end > > M.foo # => NoMethodError > M2.foo # => Error? (should it affect modules?) I'd say yes. > C.foo # => Error? (should class_extension be propagated?) I'd say no, but maybe there should be another function to import it. module M class_extension do def foo end end end module M2 include_class_extension M end module M3 include M2 end M.foo #=> error M2.foo #=> error M3.foo #=> no error > If 'class_extension' affects modules as well, do you think of any > more generic name, in place of "class" extension? module_extension, included_module_features, define_module_features, ...? --