> Even so it would be good to know the general criteria to consider.

Conceptually, I like to use these rules of thumb (I think Jim Weirich
noted it originally, but I am not sure):

1.) If the content and exact sequence of characters is the important
part, use a string.

2.) If the identity is the important part, use a symbol.

~ jf
--
John Feminella
Principal Consultant, BitsBuilder
LI: http://www.linkedin.com/in/johnxf
SO: http://stackoverflow.com/users/75170/



On Sun, Jul 3, 2011 at 11:28, Intransition <transfire / gmail.com> wrote:
> What are the important factors to consider when deciding whether to
> use symbols or strings for hash keys?
>
> I ask b/c I noticed that fileutils.rb uses strings[1], though the keys
> represent method names. Seems to me that symbols would be more
> appropriate.
>
> Even so it would be good to know the general criteria to consider.
>
> [1]https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb
> (OPT_TABLE)
>
>