[BUG] equivalence between strings and symbols

Jarvis, Robert P. (Contingent) Jarvisb at timken.com
Mon Apr 10 17:16:20 UTC 2000


> -----Original Message-----
> From:	Lex Spoon [SMTP:lex at cc.gatech.edu]
> Sent:	Monday, April 10, 2000 6:01 AM
> To:	squeak at cs.uiuc.edu
> Subject:	Re: [BUG] equivalence between strings and symbols
> 
> I kinda like #abc = 'abc'.  I doubt anyone will be terribly surprised by
> this, any more than they are surprised by 2.0 = 2.  Furthermore, Symbols
> and Strings are mostly supposed to be the same; it's just that Symbols
> are faster at certain things--why not keep their behavior
> as similar as possible?
> 
I think it's quite surprising that Symbols and Strings are ever considered
equal.  (I consider it shocking that it's not symmetric!)  Symbols are their
own sort of beast, by my way of thinking, and the fact that they're a
subclass of String is an implementation artifact.  This is borne out by the
way Symbol>>= is written, which says in effect that the only thing Symbols
should compare equal to is themselves (identity comparison (#==)).

I suggest that Symbols and Strings should never compare equal, and that the
simplest fix which could possibly work would be to change Symbol>>species to
answer Symbol instead of String.  I have no idea how badly this might break
things which depend on 'abc' = #abc answering true, while #abc = 'abc'
answers false.  One way or another this is an illogicality in the image
which needs to be repaired.

Bob Jarvis
Compuware @ Timken






More information about the Squeak-dev mailing list