From: Rick DeNatale Date: 2007-06-08T02:04:01+09:00 Subject: Re: # <--- why is the displayed number == object_id*2 On 6/7/07, Robert Klemme wrote: > On 07.06.2007 17:39, Meinrad Recheis wrote: > > On 6/6/07, Robert Klemme wrote: > >> As far as I remember this list you are the first one that mentions this. > >> So it's probably not that big an issue (at least not as confusing as > >> "singleton class" :-)) > >> > > Thanks for your answer. I came across it while debugging a running > > application via an eval console. It's not really a problem because I > > know that I need to divide the displayed id by 2 to get the object. > > Well, but that won't work for all cases. Nor for all versions of ruby. The relationship between object_id and the VALUE representation for various classes has been changing even within the 1.8.x stream. $Diety only knows what implementations like JRuby, rubinius, IronRuby etc would use for inspect which is the method which produces what you see after the ==> in irb, or call Kernel#p Inspect is intended to be used for the 'programmer' representation of an object, to help activities like debugging. So in the case of classes like Object that representation will likely have some info useful to the current internal implementation, and unless it's documented somewhare, there's no guarantee that it won't change. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/