From: Trans Date: 2006-08-26T22:30:08+09:00 Subject: Re: Support for singleton_class() (was Re: Call functions of superclass) ara.t.howard@noaa.gov wrote: > On Fri, 25 Aug 2006, Trans wrote: > > > > > Justin Bailey wrote: > >> On 8/23/06, ara.t.howard@noaa.gov wrote: > >>> On Thu, 24 Aug 2006, James Edward Gray II wrote: > >>> > >>>> On Aug 23, 2006, at 3:13 PM, dblack@wobblini.net wrote: > >>>> > >>>>> # Sigh -- Matz, *please* can we have this? :-) > >>>>> def singleton_class > >>>>> class << self; self; end > >>>>> end > >> > >> +100 - please give us singleton_class! > >> > >>> > >>> much better, imho, and used all over my own code is > >>> > >>> def singleton_class &b > >>> sc = class << self; self; end > >>> b ? sc.module_eval &b : sc > >>> end > >>> > >>> obj = Object.new > >> > >> +1 to this implementation. > > > > At the very least, 'singleton_class' is too long. Just 'singleton' > > would suffice. > > > > Alas, I wish we could just go back to 'metaclass'. > > i too would like a shorter namer, but singleton_class is in the source and has > been for years. momentum! ;-) So what wrong with just #singleton? That would be more reasible for things like: 'singleton_class.module_eval' and 'singleton_class.class_eval', which would instead read simply: singleton.module_eval singleton.class_eval > seriously though - the name comes up in google - and we all know how important > that it for newbies! Yeh. I relent. T.