Thanks, that cleared it up quite a bit!

Felipe

----- Original Message ----- 
From: "Markus" <markus / reality.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Monday, September 20, 2004 12:27 AM
Subject: Re: Nuby question about symbols


>
> I'll give it a shot:
>
>       * Symbols are an idea borrowed from lisp.  They are immutable,
>         atomic, named, globally unique values with an efficient internal
>         storage.
>               * immutable, like (say) nil or an integer, in that you
>                 can't change them, give them new values, update them,
>                 etc.
>               * atomic in that you can't "take apart" a symbol or "peek
>                 inside it" like you can with a string
>               * named, in that each symbol has a human-readable form
>                 (unlike, say, pointers)
>               * globally unique in that if a symbol is referenced
>                 anywhere in the program it is the same object that the
>                 same reference would get you anywhere else.  This is the
>                 same way integers work (7 is 7, no matter where it
>                 occurs in the program), but unlike how arrays and
>                 strings work (you can, for example, have the string
>                 "seven" in several places in your program, and they are
>                 NOT the same object).
>               * efficient in that they are usually implemented as
>                 something like an integer or a pointer, and thus are
>                 quick to compare, small to store, etc.
>       * Symbols are used wherever they are useful.
>               * Symbols fill a roll in ruby (and in lisp) something like
>                 enumerated types in pascal--in fact, if you single
>                 imagined a pre-existing enumerated type containing all
>                 possible values, that would work sort of like symbols.
>               * Symbols can be used for arbitrary state or condition
>                 labels (e.g. :male/:female, :jan, :feb, :mar...,
>                 :on,:off,:standby,:out_of_service,... :reverse,:neutral,
>                 :first,:second,:third,:overdrive etc.)
>               * Symbols can be used as "exceptional" values (e.g.
>                 :not_a_number, :to_be_determined, etc.) much as nil or
>                 -1 often are, but in a way that is much easier to read.
>                 They are much more efficient than strings, which are
>                 often also used in such contexts
>
> If that doesn't help, let me know and I'll try to dredge up some online
> references--or you can always google.
>
> -- MarkusQ
>
>
> On Sun, 2004-09-19 at 18:50, Felipe Malta de Oliveira wrote:
> > In spite of the recent comments stating that newbies should not be
afraid to
> > post silly questions, I now ask...
> >
> > Could anybody give me a little knowledge about symbols? Like what they
are,
> > why and where they're used and such...Or give me a pointer to somewhere
I
> > can find that information?
> >
> > Thanks a lot,
> >
> > Felipe
> >
>
>
>