From: Robert Klemme Date: 2004-03-31T16:24:23+09:00 Subject: Re: How are Symbol objects used "Daniel Sheppard" schrieb im Newsbeitrag news:EE0A2C5DE8D7CA4792891604D4FED52E016749F2@mlbmail.pronto.com.au... > Just saw this over at http://www.c2.com/cgi/wiki?IwannaLearnRuby and > realised I don't know the answer. > > How are Symbol objects used? > http://www.ruby-doc.org/docs/rdoc/1.9/classes/Symbol.html > Why should I use them to create class attributes? --GirtsKalnins > > > It appears to me that everywhere that you could use a symbol, you could > just as easily use a string. Is there any reason other than aesthetics > that you shouldn't just use Strings everywhere? Are Symbols just a > hangover from an older Ruby version. Additionally to everything mentioned by others: every string can be converted into a legal string but not the other way round: irb(main):007:0> "foo".intern => :foo irb(main):008:0> "\000".intern ArgumentError: symbol string may not contain `\0' from (irb):8:in `intern' from (irb):8 Regards robert