From: Hal Fulton Date: 2004-09-20T12:57:39+09:00 Subject: Re: Nuby question about symbols Mehr, Assaph (Assaph) wrote: >>I'll give it a shot: > > > [snip excellent info] > > In addition to what Markus has written, you can also read the (somewhat > brief) explanation at: > http://phrogz.net/ProgrammingRuby/language.html#symbols. > > > IIUC, symbols are implemented internally as immutable strings. Take a > look at String#intern or String#to_sym ( > http://www.ruby-doc.org/core/classes/String.html#M001310). I agree Markus's explanation was excellent. (I didn't even know that Lisp had symbols.) I'd only add that one common use for a Ruby Symbol is to stand for a method name. (That's a slightly misleading statement perhaps -- attr_accessor takes one symbol and creates two methods, but their names are both based on the symbol.) For example, attr_accessor takes symbols, as does Object#send. Hal