From: Austin Ziegler Date: 2005-12-31T00:37:49+09:00 Subject: Re: What is the difference between :foo and "foo" ? On 30/12/05, gwtmp01@mac.com wrote: > On Dec 30, 2005, at 12:45 AM, Austin Ziegler wrote: >> Sure, you could get pedantically philosophical, but the you'd be >> saying that 1 really isn't the number, it's a thing that represents a >> quantity of one. > But 1 (as in the ascii character code 49) is *not* the number/object > one. And the reference value that the Ruby parser constructs when it > sees the ascii character code 49 is also *not* the number/object one. Um. I was not referring to "1" as in the ASCII value, but "1" in the sense of an Arabic numeral. You're right; ASCII 49 is the ASCII glyph for the Arabic numeral "1" and said glyph *means* an integer value greater than zero and less than two. Only mathematicians and pedants (is there a difference? ;) tend to care about the distinction between the symbolic representation and actual value. Inasmuch as 1 represents the integer value one, any given Symbol represents itself. Really, only other immediate values can remotely be said to do that in Ruby. :wilbur represents :wilbur. No more, no less. > I don't think it is possible to have a coherent discussion of Ruby > semantics without clearly and consistently differentiating between an > object, a reference to an object, and an identifier that is bound to a > reference to the object. Um. There's no meaningful difference in Ruby between an object and a reference to that object. There is a difference between the identifier holding an object (or its reference, if you wish to be pedantic) and the object, but it is a difference that many programmers new to Ruby have to unlearn and learn (variables are labels, not memory slots, in Ruby). Some objects are created such that there can only be one object with a particular representation: immediate values. "foo" and "foo" creates two different objects; :foo and :foo create a single object. It's atomic and self-identifying. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca