From: Brian Candler Date: 2007-05-19T21:56:07+09:00 Subject: Re: Why was the "Symbol is a String"-idea dropped? On Sat, May 19, 2007 at 08:28:24AM +0900, Rick DeNatale wrote: > Most normal objects are referenced at the C level by an internal value > which is a pointer to the objects state representation in memory. > Since objects are aligned at least on a word boudary, all normal > object pointers will have the 2 least significant bits as zero. They > will also be non-zero > > A few objects are immediate which means that they are referenced at > the C level by a representation whose value is not a pointer. Fixnums > are represented by shifting the C representation left one bit and > turning on the low-order bit. False is represented by 0, True by 2, > and Nil by 4. > > Ruby symbols are represented by a value computed by shifting the > symbols integer representation left 8 bits and setting the low-order > byte to 0xFF representation Perhaps it varies based on the Ruby version you're running; it's not like that for me. irb(main):006:0> :foo.object_id.to_s(16) => "39490e" irb(main):007:0> RUBY_VERSION => "1.8.4" I think a weaker requirement than 'immediate' is needed. A symbol can quite happily be a regular object; we just need to ensure that there is always only one symbol for a particular symbol character sequence. Regards, Brian.