On Thu, Mar 08, 2007 at 04:02:02PM +0900, Brian Candler wrote:
> On Thu, Mar 08, 2007 at 02:46:43PM +0900, Chad Perrin wrote:
> > On Thu, Mar 08, 2007 at 04:21:10AM +0900, Bharat Ruparel wrote:
> > > I think of symbols is immutable strings that are useful only in 
> > > referring to some values?  Seems like a nice way for using pointers 
> > > without all the warps?
> > 
> > "Immutable strings" doesn't work so well, since a string literal is
> > "immutable" anyway.
> 
> Well maybe that's technically right, in the sense that the source code
> itself is immutable. However, every time a string literal is 'executed' a
> new, mutable string object is instantiated:
> 
> 5.times { puts "hello".object_id }
> 
> So there's no way in practice to make use of the 'immutable' property you
> describe, because every String object your program sees is mutable.

True -- which brings it back to the "strings are fleeting" thing.

Thus, the comment in my previous email about symbols being kind of like
string literals, except that they are persistent.  Because strings are
fleeting, they're actually different incidences of a string every time
they're evaluated.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"A script is what you give the actors.  A program
is what you give the audience." - Larry Wall