Dictionary keys that exist but can't be found

Bob Arning arning at charm.net
Thu Apr 11 14:27:24 UTC 2002


On Thu, 11 Apr 2002 09:07:45 -0500 Tim Olson <tim at jump.net> wrote:
>This is because Association inherits "=" from LookupKey, which only 
>compares keys for equality, so two Associations with the same key but 
>different values still compare equal.
>
>I'm not sure if this is an oversight, or if Associations are purposely 
>this way for some subtle reason in implementing the Dictionary class.
>
[snip]
>
>Does anyone know of anything in the image that relies upon associations 
>comparing equal even if their respective values are different?

There are several places that rely on Associations sorting in the same order as their keys. You might induce a minor discontinuity if

a1 >= a2 was true
a1 > a2 was false

and then, by virtue of your change,

a1 = a2 came out false.

Cheers,
Bob



More information about the Squeak-dev mailing list