Hi --

On Tue, 14 Aug 2007, Phlip wrote:

> Tim Hunter wrote:
>
>> Don't make more out of this than there is. A symbol is a kind of literal
>> in Ruby. It's the name of a number. You pick the name, Ruby picks the
>> number. Ruby guarantees that whenever you use the symbol in your program
>> it will always refer to the same number.
>
> :foo.object_id == :foo.object_id
>
> So if you add a method to one :foo, can anyone who invokes :foo access
> the method?

$ ruby -ve 'class << :abc; end'
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]
-e:1: no virtual class for Symbol (TypeError)


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)