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
So what do other's think? Is this better then depending on __id__ and a
gaagle of other __xyz__ methods, or no?
T.