Topic: Definition of Ruby Symbols

I'm wondering if this is a decent definition of what symbols are:

"A symbol type--symbols are effectively pointers to strings stored in a hash table. So you can test equality by comparing a pointer, instead of comparing each character."

I've been looking for something that explains the "implementation" of symbols, but usually get "read the C source code" (which I'm about to do...) or "it doesn't really matter how their implemented".

Now, the definition above seems pretty concise and definitive.  I think it's interesting that I found it in a discussion about the nine principles of LISP:  http://www.paulgraham.com/icad.html

Also from Ruby for Rails there is a mention that symbols are strings without the overhead (which makes sense since strings are classes with all those methods...)  Of course they're immutable and  always refer to the same thing.

There's also the point that they are used internally when you assign a variable.

Anyone else care to chime in on the specifics of symbol implementation--anyone read the C code?

Re: Definition of Ruby Symbols

try looking up symbols here http://ruby-doc.org/docs/ProgrammingRuby/

Re: Definition of Ruby Symbols

Yeah, i've read that, and in both agile books, and the ruby way...
And numerous online sources, too

According to the folks on the ruby-lang mailing list, the LISP
definition is pretty accurate, which makes the most amount of sense
to me.  Really, I was looking for a consensus on the implementation
of symbols.

Re: Definition of Ruby Symbols

here's a good explanation of symbols: http://glu.ttono.us/articles/2005/08/19 … by-symbols

Zubin