On Thu, Oct 19, 2006 at 05:06:02AM +0900, Charles Oliver Nutter wrote:
> Charles Oliver Nutter wrote:
> >Yukihiro Matsumoto wrote:
> >>  * so, Symbols are now immutable, interned strings, with some
> >>    performance enhancement.

What is the performance enhancement?

I had expectations (from coding in a lisp-dialect) about symbols, but
since

  - most ruby apis that take symbols also take strings, and
  - many apis that return things you might think would be symbols
	actually return strings (Object.methods),
  - and string comparison and symbol comparison are about the same
    speed (performance appears to be dominated by method call overhead
    for strings typical for method names),

I've started to become unclear as to why ruby even has a Symbol class.

If ruby 1.9 did

  Symbol = String

what wouldn't work? Other than methods used to convert one to the other?

Maybe the

  :athing

notation could make an ImmutableString, a base class of String, where

  :athing.object_id == :athing.object_id # => true

Sam