[BUG] equivalence between strings and symbols
John W. Sarkela
john_sarkela at 4thEstate.com
Wed Apr 5 20:12:56 UTC 2000
working with Squeak 2.7 we discovered the following situation
#squeak = 'squeak' false
'squeak' = #squeak true
mathematics defines equivalence as a relation that is
1. reflexive
2. symmetric
3. transitive
Well, the above just ain't symmetric.
The problem arises because Strings and Symbols are the
same species of collection. This satisfies the definition
of equivalence that String inherits, whilst Symbol redefines
equivalence to be identity.
My assertion is that in Smalltalk a String should never
be equivalent to a Symbol. (Too much code depends upon
Symbol identity being the same as equivalence.)
Given that, what is the correct course of action...
1. Make Strings and Symbols different species.
2. Redefine #= in String to ensure that a string and
a symbol never are declared equivalent
[ | ] John Sarkela
CTO The Fourth Estate, Inc.
More information about the Squeak-dev
mailing list
|