Reimplementing WeakKeyDictionary

"Martin v. Löwis" martin at v.loewis.de
Sun Mar 18 19:41:07 UTC 2007


David T. Lewis schrieb:
> This would be a welcome improvement!
> 
> Note also http://bugs.squeak.org/view.php?id=2910 which is also
> related to this problem. (How do you add a "relationship" in
> Mantis?)

I had indeed seen this before. On a first quick review, I agreed
with your analysis that the patch is right; on a closer look,
I agree with Andreas: it seems that the patch drops associations
with nil keys on the floor, which it shouldn't do.

In any case, my patch would also address this problem: on removal,
no rehashing is done at all. Instead, it just clears the association
of the to-be-removed key, and then stops; the association will get
only discarded when the entire dictionary gets reorganized.

Regards,
Martin




More information about the Squeak-dev mailing list