From: Jacob Fugal Date: 2005-07-26T08:43:38+09:00 Subject: Re: Trying to understand symbols On 7/25/05, Sam Kong wrote: > Symbols are often compared to strings like the following. > > h1 = {:a => 1} #symbol. faster and immutable. > h2 = {'a' => 1} > > Ok, I can understand that. > Now, is the term 'symbol' used the same meaning in the following text > (from PickAxe2 page 314)? > > > When Ruby sees a name such as a in an expression, it needs to determine > if it is a local variable reference or a call to a method with no parameters. To > decide which is the case, Ruby uses a heuristic. As Ruby parses a source > file, it keeps track of symbols that have been assigned to.... > No, they are not the same. The latter is the general meaning of symbol in a parser context. The former is a specific type of value in Ruby. Jacob Fugal