On Mon, 20 Nov 2000, Dave Thomas wrote:

> 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.

Oh, I see.  So then there is no danger in creating them at will then.
(Except the usual things of running out of memory if you create billions
of them...)
> 
> >From yu command pattern's point of view, symbols will be fast because
> they're integers, and also (depending on you implementation) because

Yes, that would help

> they can be used to denote method names in many of Ruby's library
> calls.

Yes, that is a plus point -- I noticed that attr is followed by symbol
references...
> 
> 
> Dave
> 
> 
	Thank you,
	Hugh