On Sun, Jul 3, 2011 at 5:43 PM, John Feminella <johnf / bitsbuilder.com> wrote:
>> 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.

I use a different rule of thumb which has been circulated before as
well - I can't really remember who came up with this.

1. If the set is not fixed (typically because it depends on input
obtained from somewhere) use String.

2. If the set of values is fixed (typically because the program
includes just a fixed number of keys) use Symbols.

According to that standards Fileutils should really be using Symbols
as keys and not Strings since OPT_TABLE is completely used internally
only (contains valid options of methods).

Btw, if at all conversion between the two should be employed I'd do it
as part of input processing.  This means, typically, if you have a
configuration file which may select a few items then a conversion from
String to Symbol would be part of the process which reads the
configuration file.  Internally I would make the program always work
with Symbols.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/