Devin Mullins wrote: > When I first was trying to learn about symbols, attempts to explain > their "intentions" (as names of things, for example), rather than to > explain what they are, just muddied the water for me. Sure, give me > some advice on when and when not to use them, but also, tell me what > they are, so I can decide for myself: > - Like a string, but: > - Object-level equality, so :foo.equal?(:foo) and not 'foo'.equal?('foo') > - That means, with strings, if you say 'foo' 5 times in the code, > you're creating 5 string objects, whereas with symbols, you're only > creating one. > - Share many properties with Fixnum (both being "immediate")-- > immutable, no singleton classes, object equality, not picked up by > ObjectSpace.each_object... > - Not garbage collected. > - Looks cooler -- by using a different syntax, you can give some > visual distinction between your keys and your values, for instance. - Lacking all those cool String methods like #gsub and #[] so... nothing like a string. Yeah, I dunno, the "some named thing" was just a little iffy. The PickAxe was especially annoying in this respect by trying to imply that a symbol was the name of a method, variable, or class, specifically. Maybe I'm just ranting about that. Sorry for the mess, Devin