il Wed, 31 Mar 2004 14:58:20 +0200, "Robert Klemme" <bob.news / gmx.net> ha scritto:: > >> in general, I even believe using symbols is safer than using string. >> If you are using a string and do not need it's features (take a look >> at String.instance_methods ) you may think of using a symbol (even if >> not everything is allowed as a symbol), avoiding possibly messing up >> something by changing the string. > >No, in that case you use #freeze. You should make it only dependent on >the semantics and not on the methods you actually use. It's perfectly ok >to have a string constant, when it's appropriate - even if you don't need >to change it. Apart from that methods might not accept a Symbol. I agree that it's a question of semantics. I just believe that in most cases a simple symbol is what is needed, not a String. I dont' want to let the user do stuff like: str='something' str.freeze ...use str when I can simply let him do ... use :something I.e, if there is the need to have some stringish key for an hash, I'd prefer to use a symbol over a string. But maybe it's just that typing "s" instead of :s is much harder on my keyboard :) ..