From: Yohanes Santoso Date: 2005-12-30T14:10:09+09:00 Subject: Re: What is the difference between :foo and "foo" ? Chad Perrin writes: > 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? > > 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. Well, what can I say? Symbol is really meant to represent a name/identifier. Let's stop with analogies since obviously we are not analogy-compatible, and get on with the concretes. What is 1? A way to represent the number one. You said a way, what others are there? 0x1, \001, "1". However, one does not use "1" to represent the number one even if one doesn't plan to do any arithmetic operations on that number because that representation is ambiguous. Does he mean "1" as in number one or as in the character "1"? What is :server? A way to represent the name/identifier ``server``. What others are there? "server" is another one. But it is also ambigious. Does he mean the name/identifier ``server`` or the character sequence "s","e","r","v","e","r"? I can see no way to describe 1 without involving number. Similarly, I can see no way to describe :server without involving name/identifier. Perhaps you can. > "A means for you, the programmer, to name/identify entities" is not a > description of what a symbol *is* so much as a description of how you > can use it. I really am not sure what you are saying there. That sentence describes what a symbol is. That sentence does not describe/prescribe how to use it. Here, let me paraphrase my sentence: "[Symbol is] a means for you, the programmer, to [represent the] name/identit[y] of entities". Did I manage to preserve the meaning? Let's do word substitution. "Number is a means for you, the programmer, to represent numbers". In no way am I describing/prescribing how to use instances of Number. > object", or something like that, without any explanation of what a > symbol actually does behind the scenes. This is precisely the kind of explanation that I objected when explaining what a symbol is to a newcomer. Any explanation that refer to the implementation is doomed to be short-lived. There are many ways to implement the class Symbol and the concept of symbol. Do you explain what number does behind the scenes to someone asking 'What is a number?' Do you explain that ruby maps number less than 2^31-1 directly to native integer format? Quick question, then: does this still hold on a 64-bit machine? How about in ruby 2.0? Will Number behave differently and is used to represent different thing there simply because what goes on behind the scene has changed? If one is interested in how something is implemented in a specific environment, one should ask for that (and there are posts in this thread dwelving into how Symbol is implemented in current ruby VM). In any case, if someone can give me a description of what 1 is without involving number, then I'll show you a description of what symbol is without involving name/identifier. YS.