From: Rob Biedenharn Date: 2007-09-25T09:33:26+09:00 Subject: Re: object_id 1, 2, 3 $ irb irb(main):001:0> true.object_id => 2 irb(main):002:0> nil.object_id => 4 irb(main):003:0> false.object_id => 0 I saw a flowchart somewhere (online?) that showed how the least- significant bits were used by the interpreter in the implementation of some "objects" which were both common and immutable (TrueClass, FalseClass, NilClass, Fixnum). The LSB=1 is Fixnum (hence the object_id of n would be (n<<1)|0x01 in the underlying C code). -Rob On Sep 24, 2007, at 8:14 PM, SpringFlowers AutumnMoon wrote: > Fixnum object_id > 0 1 > 1 3 > 2 5 > > -1 -1 > -2 -3 > > > so the question is... which objects have the object_id 2, 4, 6, > and -2, > -4, etc? > > > > > irb(main):041:0> a = 0 > => 0 > irb(main):042:0> a.object_id > => 1 > > irb(main):043:0> a = 1 > => 1 > irb(main):044:0> a.object_id > => 3 > > irb(main):045:0> a = 2 > => 2 > irb(main):046:0> a.object_id > => 5 > > irb(main):047:0> a = -1 > => -1 > irb(main):048:0> a.object_id > => -1 > > irb(main):049:0> a = -2 > => -2 > irb(main):050:0> a.object_id > => -3 > -- Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com