From: zdennis Date: 2006-06-11T22:53:08+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, 9 Jun 2006 00:49:19 +0900, "Alder Green" writes: > > |I see your and Dblack's point about the need for an #include that > |won't inherit the class methods. And I agree that it's probably a good > |idea to keep #include behaving as it does right now. So adding a > |separate #inherit seems like a very good idea. > > I don't like the name #inherit. Since it is not a inheritance. > Why change the name of include, why not just give it some options. The behavior is still the same, it is just the scope (singleton or instance level methods) that is changing. include Foo # current behavior # (more explicitly 'include Foo, :instance_methods include Foo, :singleton_methods # include only singleton methods include Foo, :all # include both instance and singleton methods I think it makes more sense to reuse the name include for this rather then a new name, since the behavior isn't changing. Only the scope it applies to. One possible drawback of this is that it would always include singleton methods at the class-level for the including class. And someone wouldn't be able to use this to include a singleton method as an instance method on a class. I personally wouldn't want to do this (seems way to confusing), but perhaps someone else does. Zach