>> 
> I see the value in being able to choose both. WeakRegistry uses
> #allAssociationsDo:, not #associationsDo:. Seems like it would be more
> consistent to also have an #allDo: that includes values of collected
> keys, and a #do: that does not.

yes and a good method comment

> 
>> 
>>> So I *think* this is an oversight, and is easy to fix by defining
>>> WeakKeyDictionary>>do: in terms of self associationsDo:.
>>> 
>>> But then there's the question of #size. The collection above answers 1
>>> to #size, which also seems wrong.
>>> 
>> #size for weak key dict is non-deterministic. Because even if you want to 
>> know
>> the exact number of elements, you will need to iterate over the
>> collection, but then,
>> iteration can trigger GC, and you have a big chances to answer wrong value.
> 
> That seems reasonable, though there's no effort to even come close in size.
> 
> -Martin
> 
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to