On Thu, Mar 08, 2007 at 04:21:10AM +0900, Bharat Ruparel wrote:
> I think of symbols is immutable strings that are useful only in 
> referring to some values?  Seems like a nice way for using pointers 
> without all the warps?

"Immutable strings" doesn't work so well, since a string literal is
"immutable" anyway.  You might differentiate by mentioning that the
string is fleeting and the symbol persistent, perhaps.  A string literal
only exists as long as the interpreter is evaluating -- whether for
assignment, for printing to standard out, or whatever else it may be
doing with it.  You might also differentiate by pointing out that string
literals are not necessarily unique, while symbols are -- duplicate
string literals may be stored in several different variables at once.
In fact, several copies of a given string literal might all be stored in
the same array.  A symbol, meanwhile, is unique -- and everything that
looks like a copy is actually making reference to the same thing under
the hood.

This is where you start getting into implementation, though, which some
Rubyists consider verboten as a means of defining symbols when
discussing it within the context of the language.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Amazon.com interview candidate: "When C++ is your
hammer, everything starts to look like your thumb."