From: Brian Candler Date: 2007-05-16T00:03:52+09:00 Subject: Re: Why was the "Symbol is a String"-idea dropped? On Tue, May 15, 2007 at 11:53:08PM +0900, Brian Candler wrote: > Yes, but it's not a singleton. > > It would only be of interest as a Symbol replacement if IString.new("foo") > always returned the same object. You could implement this using the Multiton > pattern I think. > > Then you could safely use IString#object_id as a method name key. P.S. I'm aware of Symbol#to_i, but to_i and object_id appear to be intimately related: irb(main):001:0> :foo.to_i => 14817 irb(main):002:0> :foo.object_id => 148178 irb(main):003:0> :bar.to_i => 16081 irb(main):004:0> :bar.object_id => 160818 irb(main):005:0> :zzzzzzzzzzzzzzzz.to_i => 16089 irb(main):006:0> :zzzzzzzzzzzzzzzz.object_id => 160898 irb(main):007:0> :puts.to_i => 7345 irb(main):008:0> :puts.object_id => 73458 irb(main):009:0> i.e. I don't think the symbol table maintains an explicit integer key for each symbol.