On Thu, Dec 29, 2005 at 11:37:59PM +0900, Yohanes Santoso wrote: > > > As this thread quite well demonstrates, > > a definition for Symbols is quite difficult to come up with. > > A formal definition is difficult to formulate correctly, but what CLHS > has is good enough: > > "Symbols are used for their object identity to name various entities > in Common Lisp, including (but not limited to) linguistic entities > such as variables and functions." -- > http://www.lisp.org/HyperSpec/Body/syscla_symbol.html#symbol Ever since this discussion started, I've wondered if there was some relationship between Ruby symbols and Lisp symbols. This is the first thing I've seen that seemed to indicate that, though. Prior to this quote you provided, everything that has been said in this discussion of Ruby symbols has seemed to indicate that there is zero relationship between the two. So tell me: Is a Ruby symbol basically just an object oriented implementation of the Lisp concept of a symbol? If that's the case, what's up with all this tripe about "a symbol is just a name" and so on? I get the distinct impression that either there's no real relationship between Ruby symbols and Lisp symbols, or else all the people trying to explain Ruby symbols don't much know what they're talking about. > > It is just a way to name/identify things. In RL, you name/identify > that collection of atoms 'bird', and another collection of atoms > 'cow'. In ruby, you name/identify an object 'host', and another object > 'port'. Just as you name parts of collection of atom that you named > 'bird' 'wings', 'legs', 'feathers', etc., you name parts of a > Hashtable that you named 'ServerConfig' 'host', 'port'. Until you mentioned the hash table in that paragraph, it didn't make any sense at all. I think these analogies are doing a disservice to people trying to get a read on what a symbol is in Ruby. You might as well go back to trying to explain OOP with truck analogies, which never worked worth a damn for explaining the concept either, if you are going to do that. It's impressively frustrating trying to make heads or tails of this discussion of Ruby symbols: people are full of analogies and categorical statements that don't really explain anything, but there isn't a whole lot of substance to it. If you tell me that Ruby symbols are basically just Lisp symbols, implemented in an OOP way by way of a symbol class, I think I could probably come up with a succinct and clear explanation of what a Ruby symbol is that would remove a lot of the ambiguity, but so far I still don't know if that's what a Ruby symbol actually is. > > Just as one does not dumbed down "'everything' is an object in ruby", > which is a powerful ability, one should not dumbed down "symbols are > user-defined identifiers". It's just parts of learning curve. Dumb down? No, never. Try explaining it, though. Identifier for what? While you're at it, define "identifier" within this context. -- Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ] "Real ugliness is not harsh-looking syntax, but having to build programs out of the wrong concepts." - Paul Graham