[BUG] equivalence between strings and symbols

Roel Wuyts rwuyts at vub.ac.be
Thu Apr 6 08:50:18 UTC 2000


We found other 'strange' behavior with strings and symbols... for example:
#squeak printString -> 'squeak'

This is sometimes confusing (especially for some of the stuff that we are
doing). It is also different than in some other Smalltalks. I think that it
should be:

#squeak printString -> '#squeak'

making clear that is is a symbol you are printing.

We made this fix in our system. The only thing that broke (as far as we can
see) was the changesorter, so we fixed that too.

I have attached the changeset in gzip-format.

> 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.
>
>


--
Roel Wuyts                    Programming Technology Lab
rwuyts at vub.ac.be              Vrije Universiteit Brussel
http://prog.vub.ac.be/~rwuyts
Webmaster of European Smalltalk User Group: www.esug.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/x-compress
Size: 625 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000406/c4aa9838/attachment.bin


More information about the Squeak-dev mailing list