Dictionaries broken in 3.9a

Andreas Raab andreas.raab at gmx.de
Sun Sep 18 10:32:10 UTC 2005


stéphane ducasse wrote:
>> will raise an error in 3.9a saying that "Dictionaries cannot  
>> meaningfully key by nil". That makes no sense. Dictionaries can  
>> perfectly contain nil keys, they always have and they always will.
> 
> Andreas why are you saying that with that kind of implication. Now  you 
> can get mad about changes, this is perfectly comprehensible
> but try to be nicer, your kind of anger does not help us.

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, 
 > I do not have dolphin at hand.

That's hillarious! In particular considering that VW allows nil in sets...

Cheers,
   - Andreas



More information about the Squeak-dev mailing list