From: Robert Dober Date: 2009-02-04T06:06:11+09:00 Subject: Re: Object#singleton_class in Ruby 1.9? On Tue, Feb 3, 2009 at 2:44 PM, David A. Black wrote: > On Tue, 3 Feb 2009, Thomas Sawyer wrote: > > class << obj > def x > end > end > > module M > def x > end > end > obj.extend(M) # obj.x is still the first one > > Since you can always reopen the singleton class and redefine the > method, using the singleton class in the first place doesn't mean that > you're stuck with the original method definition. > > I think #extend is highly underutilized. It's one of my favorite Ruby > techniques. I just don't feel that it has to be in a death-struggle > with any other techniques. Well is that not exactly what Tom meant? Maybe someone can update me here please? My understanding is that: If people would use extend instead of class << etc the "metaprogrammers" (e.g. somebody creating a framework or an extensions for traits as I did ) could produce code easier just by saying: As long as you extend your object and classes and never use << my framework is shielded. If you reopen singleton classes, well you are at your own. Cheers Robert -- It is change, continuing change, inevitable change, that is the dominant factor in society today. No sensible decision can be made any longer without taking into account not only the world as it is, but the world as it will be ... ~ Isaac Asimov