From: Steve Litt Date: 2005-12-30T23:56:31+09:00 Subject: Re: What is the difference between :foo and "foo" ? On Thursday 29 December 2005 07:36 pm, Chad Perrin wrote: > On Fri, Dec 30, 2005 at 05:07:35AM +0900, Yohanes Santoso wrote: > > Chad Perrin writes: > > > If that's the case, what's up with all this tripe about "a symbol is > > > just a name" and so on? > > > > Because it's true? Because there are people who don't have lisp > > background who are not familiar with what symbol is? Because there are > > people who thinks symbols are magical thingie? > > It's not really true, though, considering what a symbol is (according to > my current understanding). A symbol is an element of a hash table that > is often used as a name, and it is an (anonymous? not sure how to > qualify that) object. Calling it a "name" seems to be confusing common > use with actual nature, or premature explanation of an abstract way of > thinking about it, depending on how you mean "it is a name" when you say > it. Either way, it seems to be getting the cart before the horse. And now you have identified the crux of all the misunderstanding (and I think "misunderstanding" is the right word, given that tens of people smarter than me disagree with each other on how to describe a symbol). Long time Rubyists, people with heavy CS studies, and people who have experience in languages with symbols (LISP, I guess) tend to talk more about how it's implemented, while programmers (probably without CS degrees) migrating from languages not containing symbols are more interested in what it does than how it's implemented. I asked if it's an object with 2 attributes, an integer key and a string value. Someone says no, it's an object with one attribute that can be seen 2 ways, a string or an integer. From my point of view, he's saying the same thing. I was describing what it can do for me, he was describing something truer to the implementation, but when actually using the little bugger either explanation will lead to correct programming, at least if I understand it correctly (and I think I now understand it correctly, at least correctly enough to know how and when to use a symbol). One thing I know for sure -- the length and bredth of this thread indicates for sure that Ruby symbols need much better documentation. Austin Ziegler has made an excellent start. I volunteer to give input from an imigrant from Perl land (and C, C++, and about a dozen others but not lisp) whose BS degree is in Electrical Engineering and whose computer programming classes were limited to the very practical stuff they taught at Santa Monica Community College. SteveT Steve Litt http://www.troubleshooters.com slitt@troubleshooters.com