-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2005.12.30 11:38, Chad Perrin <perrin / apotheon.com> wrote:
> On Fri, Dec 30, 2005 at 10:46:23AM +0900, Eero Saynatkari wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On 2005.12.30 06:56, dblack / wobblini.net wrote:
> > > 
> > > This assertion by me seems to have been mercifully ignored in
> > > subsequent discussion :-)  Actually, s = :sym doesn't produce a
> > > reference to :sym; rather, s has the actual/immediate value :sym.
> > > Anyway, the main (obscured) point was that symbols are not references.
> > 
> > This is another bad aspect of Symbol explanations. Sooner or later 
> > someone mentions 'immediate values' or 'internal symbol tables'.
> > While accurate (and in some cases, useful knowledge), these are a
> > big source of confusion and not in any way helpful to understanding
> > the fairly trivial function of Symbols :/
> 
> I disagree.  If the underlying semantic mechanism of a symbol isn't
> understood, symbols won't be understood.

Neither of the above is in any way essential to understanding the
concept of a Symbol (as it appears in ruby), they are implementation
details. Symbols could perform the exact same function they do now
even as a user-defined construct. I do not think it is at all necessary
to know either of these facts to be able to use Symbols.

I am, of course, only speaking from my own point of view but I
do have some experience in introducing ruby Symbols to new users.
Doing that I have found that it is simplest to introduce Symbols
as names or descriptive values, similar to regular strings in that
respect. This but-what-are-they-for foundation established it is
easy to introduce additional implementation details.

One size definitely does not fit all; people learn differently.

  1. Symbols are values. 
     :foo is like 'foo' or 2 or f = FooObject.new

  2. Symbols are used to name, describe or label things. 
     cd_drive_type = :dvd_rom
     socks = my_closet[:sock_drawer]

  3. Common usages.
     object.send :method_name, parameter    # Could use 'method_name'
     attr_accessor :property1, :property2   # Could use 'property1' etc.

  4. Implementation details.


E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDtMJTxvA1l6h+MUMRApnZAJ9O8dm9GAw+NTVT5AibfIBWPqFzmgCglyXm
i0rCU+NMdYvNP7b1GA5wg+I=
=WSB5
-----END PGP SIGNATURE-----