From: Nikolai Weibull Date: 2006-11-08T09:50:02+09:00 Subject: Re: No more Symbol < String? On 11/8/06, Nobuyoshi Nakada wrote: > - Symbols are never garbage-collected > > So I don't encourage to use Symbol as a substitute for String > now, especially in libraries and long-running applications. > > Since the current Symbol is based on internal ID, it would be > important to separate them for such usage. It seems that people have a very hard time understanding this. It may even be so that Symbol is a case of premature optimization, in a sense, as it's more or less a way to optimize away string constants and hash calculations of strings, which is fine, but it results in people thinking that they're strings because Symbol tries too hard to also act like a string and that they can more or less use them interchangably. I think it's reasonable to get a string back from a Symbol, but perhaps #to_str is a bit hefty a claim. Would :a.to_str.object_id always be the same? nikolai