From: Robert Klemme Date: 2009-12-23T16:58:20+09:00 Subject: Re: integers and floats 2009/12/22 Florian Gilcher : > > On Dec 22, 2009, at 11:19 AM, Robert Klemme wrote: > >> 2009/12/22 Florian Gilcher : >>> >>> On Dec 22, 2009, at 11:03 AM, Paul Smith wrote: >>> >>>> On Tue, Dec 22, 2009 at 2:16 PM, Rajinder Yadav wrote: >>> >>>> I have no idea what, if anything, has the object_ids 0, and 2. >>> >>> Pretty easy: false and true. >>> >>> irb(main):001:0> true.object_id >>> => 2 >>> irb(main):002:0> false.object_id >>> => 0 >> >> You need to know but there is a way that works without oracle turing machine: >> >> irb(main):005:0> 10.times {|i| printf "%4d %p\n", i, >> ObjectSpace._id2ref(i) rescue nil} >>   0 false >>   1 0 >>   2 true >>   3 1 >>   4 nil >>   5 2 >>   7 3 >>   9 4 >> => 10 >> >> :-) >> > I didn't use oracle turing machine, I only used irb to validate my pre-existing knowledge. See, that's exactly what I meant. > But thanks for the trick :-). You're welcome. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/