From: "Jesús Gabriel y Galán" Date: 2012-02-10T22:52:36+09:00 Subject: Re: Symbol garbage collection On Fri, Feb 10, 2012 at 1:48 PM, Robert Klemme wrote: > 2012/2/10 Jesús Gabriel y Galán : >> On Fri, Feb 10, 2012 at 11:07 AM, Robert Klemme >> wrote: >>> On Fri, Feb 10, 2012 at 8:28 AM, Dido Sevilla wrote: >>>> I've always wondered why Ruby didn't do garbage collection of symbols, >>>> when Lisp implementations here and there did so, and in fact they are >>>> essential in macro programming because Lisp programs tend to create a >>>> lot of unique symbols at runtime, especially in macro code, with such >>>> contrivances as gensym in Scheme and Common Lisp and uniq in Arc. >>> >>> In Ruby the idea is rather to only use a fixed amount of Symbols in >>> the program and use Strings for everything that changes often. >> >> I have a question about this rule of thumb: did this rule came to >> existence precisely due to the fact that Symbols are not GCed, or was >> it the other way around? > > I can't speak for Matz but from what I have gathered it was his very > conscious design decision to have Symbols not GC'ed. > >> Maybe if Symbols' garbage collection wasn't a problem, that rule about >> using them just in a limited and fixed amount would have never >> existed. > > But without this distinction there is really no point in having String > AND Symbol any more.  A Symbol then would merely be a String which is > frozen by default.  I prefer the current situation because it makes > much more sense in my opinion.  With a symbol we denote a fixed > identifier which is used in multiple locations of an application and > with a String we denote arbitrary text content. Makes sense, thanks. Jesus.