From: "David A. Black" Date: 2007-09-17T23:12:23+09:00 Subject: Re: Newbie help Hi -- On Mon, 17 Sep 2007, 7stud -- wrote: > unknown wrote: >>> After editing that sentence a couple of times, I completely changed the >>> meaning into something quite confusing. A symbol *always* refers to a >>> string. That should read: >> >> I'm not sure I'd put it that way. A symbol, like a string, can always >> be represented by characters, but I don't think a symbol actually >> refers to a string, any more than the string refers to the symbol. But >> I may be misunderstanding what you mean. >> > > Then where is the error in this diagram: > > > s1 = :hello > s2 = :hello > s3 = :hello > > "hello" > ^ > | > | > symbol_obj > id:2545934 > ^ ^ ^ > | | | > s1 s2 s3 If the top arrow means that the symbol :hello contains a reference to a string "hello", in the same way that s1-3 are bound to references to :hello, then I would say that's the error. A symbol can be converted to a string, such that the string represents the same sequence of characters as the symbol; but the symbol is not a reference to a string object. 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)