From: Rick DeNatale Date: 2007-03-09T06:05:35+09:00 Subject: Re: Paul Graham explains Ruby symbols On 3/8/07, David A. Black wrote: > Hi -- > > On 3/8/07, Gary Wright wrote: > > > > On Mar 8, 2007, at 12:41 AM, Chad Perrin wrote: > > > Obviously, a symbol is different in easily explained ways from string > > > variables, without having to drag implementation into it. Things > > > aren't > > > quite so clear-cut between symbols and string *literals*, though. > > > > I'm not sure that the problem you are describing has anything to do with > > symbols. Anyone learning Ruby is going to have to understand the > > difference between "1", 1, 1.0, /1/, and :1. Symbol literals > > aren't really special in this regard. > > I'll add yet another way of thinking about symbols, namely that they > are very integer-like. All of the immutable, unique, immediate-value > stuff is not so much a modification of how strings behave as a rather > exact replication of how integers behave. As Obi-wan Kenobi would say, "that's (only) true from a certain point of view." irb(main):002:0> :a + :b NoMethodError: undefined method `+' for :a:Symbol from (irb):2 ;-) -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/