From: dblack@... Date: 2006-06-17T06:28:51+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Hi-- On Fri, 16 Jun 2006, 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?) Yes, I think so. > C.foo # => Error? (should class_extension be propagated?) I think not. The call to class_extension in M registers a policy on the part of M. The policy affects M2, but it should not be shared by M2. > If 'class_extension' affects modules as well, do you think of any > more generic name, in place of "class" extension? Sean O'H. mentioned "extension", which I think is as good as it will get. (I'm still not a fan of this whole thing.) David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) See what the readers are saying about "Ruby for Rails"! http://www.rubypowerandlight.com/quotes