Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:

> I'd like to know a bit more about Symbols.  I know that if a variable,
> class, or method are given one name, then that name is associated with a
> symbol, and only one symbol.   Presumably this doesn't make the Symbol
> global, it is more like Fixnums having only one object, so that  1  refers
> to the same object whereever it is used.  Is that about right?

A symbol is simply an internal representation of a name. You could
think of Ruby having a big array internally where every name it comes
across is stored. The symbol would be the index into that array.

From yu command pattern's point of view, symbols will be fast because
they're integers, and also (depending on you implementation) because
they can be used to denote method names in many of Ruby's library
calls.


Dave