From: transfire@... Date: 2006-06-17T22:00:33+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Austin Ziegler wrote: > On 6/16/06, Christian Neukirchen wrote: > > "Austin Ziegler" writes: > > > Should we have __dup__ and __clone__ and __class__ and __object_id__? > > Instead of further pythonizing the language (sorry, couldn't resist), > > I'd rather prefer a non-OO way for the tricky cases: > > > > Object.object_id_of myobj > > Object.class_of myobj > > Object.send_to myobj, :foo > > > > Maybe it's not optimal to make them singleton methods of Object, a > > module would probably be better. > > I could get behind that. Probably worth an RCR, I think. I expiremented with that idea a while back when I was doing some work on the BasicObject class. I expirementd with offering a variety of "extenal" meta-programming methods as module methods of ObjectSpace. And I also tried using global variable lambas, eg. $object_id[myobj]. While the former was more POLS, the globals actually proved nicer to use. Yet I'm not sure its the right approach. Is it that big a deal to have a handful of __ methods? If so then maybe the milder appraoch of a single non-overwriteable "self knowledge" method would be a good way, 'myobj.self(:id)' or even 'myobj.self.id' for instance. T.