From: "Glenn Smith" <glenn.ruby / gmail.com>
>
> Nope, still not entirely sure I *get* symbols.

More info:
http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/113107

> I'm writing stuff in rails at the moment, and *seem* to have free
> choice as to whether to use something like:
> 
> @params[:year]
> 
> or
> 
> @params['year']
> 
> What's the difference?

In the above usage, I'd guess the difference is "not much", or
"one fewer character typed". :)  

Probably (just a guess) the @params behind the scenes is a 
hash that has keys of Strings not Symbols.  If this is so, then
in the above, :year is being converted, probably, with .to_s
before being used as a lookup in @params hash anyway.

So from the programmer's point of view, in the above situation,
the use of the symbol probably just comes down to aesthetics.

But, here's an example showing the speediness of symbol-to-
symbol comparisons:

>> val = :abcdefghijklmnopqrstuvwxyz
=> :abcdefghijklmnopqrstuvwxyz
>> t1 = Time.now; 1_000_000.times { val == :abcdefghijklmnopqrstuvwxyz }; Time.now - t1
=> 0.671

vs. Strings:

>> val = "abcdefghijklmnopqrstuvwxyz"
=> "abcdefghijklmnopqrstuvwxyz"
>> t1 = Time.now; 1_000_000.times { val == "abcdefghijklmnopqrstuvwxyz" }; Time.now - t1
=> 2.283


Regards,

Bill