From: Christian Neukirchen Date: 2005-09-24T19:26:15+09:00 Subject: Re: Inspect, looking in from the outside "Trans" writes: > I've refined the module idea. I moved the methods to ObjectSpace > instead. So: > > class C > def object_id ; "Argh!" ; end > end > > c = C.new > c.object_id #=> "Argh!" > > Yes, we've been thwarted, but OpectSpace to the rescue! > > ObjectSpace.object_id(c) #=> -606603492 > > There are some shortcuts too like: > > ObjectSpace.id(c) #=> -606603492 > > One might wonder about the methods that are being overridden in > ObjectSpace itself. Well, despite their very rare potential usage, > that's the whole problem this intends to solve. So, > > ObjectSpace.object_id(ObjectSpace) #=> -605307980 ObjectSpace.object_id_of(ObjectSpace) #=> -605307980 ObjectSpace.object_id #=> -605307980 > So what do other's think? Is this better then depending on __id__ and a > gaagle of other __xyz__ methods, or no? I've been thinking about having #send and #object_id as external methods too, and I like the idea. > T. -- Christian Neukirchen http://chneukirchen.org