From: dblack@... Date: 2006-06-09T19:43:35+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Hi -- On Fri, 9 Jun 2006, Phil Tomson wrote: > What about a this approach: > > module A > def A.foo > "this method wouldn't get mixed in" > end > def self.bar > "this method would get mixed in" > end > end > > class B > include A > end > > B.bar #=> "this method would get mixed in" > B.foo #=> no method error > > So the idea would be that if you use 'def self.' the > method would be mixed in, but if you use 'def . name>' it would not be mixed in. > > > ...I'm not sure how easy/hard/possible this would be to implement, > though, or if it's even practical. I think that's a dangerous path to go down. self is really just an alias for a particular object at a particular time, and having it be more "magic" than that could get messy. David -- David A. Black (dblack@wobblini.net) * Ruby Power and Light, LLC (http://www.rubypowerandlight.com) > Ruby and Rails consultancy and training * Author of "Ruby for Rails" from Manning Publications! > http://www.manning.com/black