Fork me on GitHub
Its the Code garbage collector. Mind dumps of daily coding antics from a frustrated silly little man. VBS, PHP, TCL, TK, PERL, C++, JAVA....what now? Ruby?
No Wait.. It should be just RUBY!

20100222

A quick look at object_id in ruby..

Ruby VALUEs and object_ids @oreillynet has a detailed explanation about the assignment method.

irb(main):001:0> "".object_id
=> 23653260
irb(main):002:0> "".object_id
=> 23649800
irb(main):003:0> 1.object_id
=> 3
irb(main):004:0> 0.object_id
=> 1
irb(main):005:0> 2.object_id
=> 5
irb(main):006:0> true.object_id
=> 2
irb(main):007:0> false.object_id
=> 0
irb(main):008:0> nil.object_id
=> 4
irb(main):009:0> @foo = 1
=> 1
irb(main):010:0> @foo.object_id
=> 3
irb(main):011:0> @foo.object_id
=> 3
irb(main):012:0> @foo = " "
=> " "
irb(main):013:0> @foo.object_id
=> 23612570
irb(main):014:0> @foo.object_id
=> 23612570

No comments: