Dictionaries broken in 3.9a

stéphane ducasse ducasse at iam.unibe.ch
Sun Sep 18 10:56:44 UTC 2005


Andreas.

Ok I understand. Next time put sigh.....
Now I try to understand the relation will the WeakDictionary fix  
presented in my previous email.

> Actually, I'm not mad (at least not at the author) and the above  
> should really be read with a big "sigh" upfront. It is likely that  
> the author was inspired by the error message from Set (notice the  
> similarity between "Sets cannot meaningfully contain nil as an  
> element" and "Dictionaries cannot meaningfully key by nil")  
> probably assuming that because Dictionaries are Sets of sorts the  
> same invariant would hold.
>
> However, in Set there is an an ambiguity between a free slot in a  
> set and a slot containing nil[*] but in dictionaries we store  
> associations and therefore we can distinguish between an empty slot  
> and a slot keyed by nil. And therefore, *sigh*, Dictionaries have  
> always contained nil keys and they always will :-)
>
> [*] Which would be easy enough to fix if someone really cared.
>
>
>> Now as I say in my previous email nil is not allowed in Visualworks,
>>
>
> That's hillarious! In particular considering that VW allows nil in  
> sets...

But this is like that. Certainly result of an evolution or not  
breaking client code process.
By the way you should have a look at HashTable on Squeaksource  
because the implementation of Dictionary there
is much better in terms of collision strategy.

Stef



More information about the Squeak-dev mailing list