From: Eric Hodel Date: 2005-12-22T06:31:10+09:00 Subject: Re: A interesting obervation about object_id method On Dec 21, 2005, at 5:00 AM, Dan Diebolt wrote: > Anyone else notice that the object_id of an integer (at least for > Fixnum) is twice the integer plus 1? > > irb(main):030:0> 1.object_id > => 3 > irb(main):031:0> 2.object_id > => 5 > irb(main):032:0> 6534.object_id > => 13069 > irb(main):033:0> 2*6534+1 > => 13069 Using pointers to odd memory addresses a common way of representing integers. non-Fixnums always have even ids since they are pointers to valid addresses. nil, true and false have special values. -- Eric Hodel - drbrain@segment7.net - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com