From: Thomas Enebo Date: 2006-10-19T23:31:59+09:00 Subject: Re: Symbol < String in Ruby > 1.8 Sam Roberts wrote: > >>I still don't understand why there is Symbol at all in Ruby<<, > though, it > seems that it could be entirely replaced by String, UNLESS it does > something faster/better than just String#freeze. I know the object_ids > are the same, but using Symbol instead of String doesn't seem to make > comparisons fast, at least in ruby code (maybe it is faster in C?). > > This is an interesting question (stuff between >> <<) to me also. I guess saying something requires immutable strings would be fine and if you passed a mutable one it would generate an immutable one (most functions accept string now and to_sym it). Is Symbol as subclass of String more useful than String which can be mutable or immutable? I guess there are always more than one way to skin a cat, but I am trying to understand motivation (perhaps backwards compatibility?)? -Tom