Equality of Recursive Structures [Was: Closure Compiler in 3.9 ?]

nicolas cellier ncellier at ifrance.com
Fri May 11 19:59:48 UTC 2007


Lukas Renggli a écrit :
>> Cue another long discussion about hashing.
>>
>> Just what do you believe the hash value should be based on?
> 
> What about the key only?
> 
> I quickly had a look at some other Smalltalk implementations (VW,
> Dolphin, Ambrai) they all use the key for hashing only.
> 
> Lukas
> 

As a LookupKey, Association should behave like Lukas said.
Also, look at this funny bug introduced by Association>>#= :

| a1 a2 |
a1 := #a -> 1.
a2 := #a -> 2.
{a1 >= a2. a2 >= a1. a1 = a2}
	"true, true, false"

I do not know how mathematicians do qualify this kind of relation...


But among more than 30 references to Association, and 100 sendes of #-> 
how to tell whether Association>>#= ever need to test the value ?
(this is of course why Associations>>#hash is defined )

Quiet sure there are some uses that do not consider Association like a 
LookupKey but just as a C++ std::pair.

Nicolas




More information about the Squeak-dev mailing list