From: dblack@... Date: 2006-07-29T05:05:34+09:00 Subject: Re: does ":" have an anolog in another language? Hi -- On Sat, 29 Jul 2006, Matt Todd wrote: > A simple way to describe it may be to look at it as a singleton object > in that, every unique symbol is a different object, but all of the > same symbols are the same object. > > For instance... > > x = Foo.new('bar') > y = Foo.new('bar') > z = Foo.new('baz') > > Both x and y will be the same object, but different references. In the general case (i.e., unless you override Foo.new), x and y will be different objects: class C def initialize(x) end end p C.new('a').object_id p C.new('a').object_id You'll get different numbers. David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.