From: Justin Johnson Date: 2002-08-01T03:59:43+09:00 Subject: Re: How to Emulate C/C++ Pointer/Reference in Ruby? > The thing is that in Ruby, every variable holds a reference to some > object, and variables are all at the same level of remove from their > objects. (This is probably wrong or different for immutables, but I'm > excluding them for the moment.) So if you have: nil, true, false and FixNum are internally stored by value. The runtime checks for these special types and so if you type: 32.class it gives you what you'd expect: "FixNum". Even though: val = 32 Stores the value in 'val' rather than creating a FixNum object of value 32 and setting 'val' as a reference to it. That would have been easier and more consistent but would have increased object creation and memory footprint. The price you pay is loosing 1 bit of information for FixNums. :-) Internally, I'm not sure why nil, true and false aren't handled as references to instanced objects of class NilClass, TrueClass and FalseClass. This would reduce the number of internal special case checks....Matz? -- Justin Johnson.