[BUG] equivalence between strings and symbols

Doug Way dway at mat.net
Thu Apr 6 21:47:52 UTC 2000


This has been brought up before, but was never implemented in the base
image.  It certainly seems like the right thing to do, though.

Count this as a plug for inclusion.  (I suppose there could be other
side-effect bugs, so if we're close to 2.8, maybe it could wait until
2.9alpha.)

- Doug Way
  EAI/Transom Technologies, Ann Arbor, MI
  http://www.transom.com
  dway at mat.net, @eai.com


On Thu, 6 Apr 2000, Roel Wuyts wrote:

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





More information about the Squeak-dev mailing list