3 ms·
No worries, thanks for taking the time to write it out. I'm glad that I wrote the post (and that I'm getting hammered a little for my assumptions) because makin
by aarongough 16y ago
No worries, thanks for taking the time to write it out. I'm glad that I wrote the post (and that I'm getting hammered a little for my assumptions) because making mistakes is probably the only way I'm going to get a deeper understanding of the language...
One thing that confused the issue a little for me is the fact that some objects in Ruby are actually only really 'pretend objects'. ie:
>> test = 4
=> 4
>> test2 = 4
=> 4
>> test.object_id
=> 9
>> test2.object_id
=> 9
I don't know enough about the deeper parts of the language to know what else there is that's like this though...
- bschaefer 16y agoThis is a performance optimization for common (read: integer) numbers: http://ruby-doc.org/core/classes/Fixnum.html http://ruby-doc.org/core/classes/Fixnum.html >> ((1 << 30) - 1).class => Fixnum >> ((1 << 30)).class => Bignum >> ((1 << 30) - 1).object_id => 2147483647 >> ((1 << 30) - 1).object_id => 2147483647 >> (1<<30).object_id => 166070 >> (1<<30).object_id => 161200