[squeak-dev] Undeclared -> WeakIdentityDictionary -> wrong tally -> wrong #size

Marcel Taeumel marcel.taeumel at hpi.de
Wed Feb 26 14:16:30 UTC 2020


Hi Levente,

hmm... but WeakSet does also not respond correctly to #isEmpty. Yes, there is a bug with tally calculation as you descrined. However, all weak collections can only support #maybeNotEmpty and never #isEmpty (because of the false case).

Best,
Marcel
Am 26.02.2020 14:54:46 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
Hi Marcel,

The cause of the problem is that unlike other weak hashed collections,
WeakIdentityDictionary does not recalculate tally in
#noCheckNoGrowFillFrom:. And that's a bug, because it lets tally increase
indefinitely.

The bug appears now, because before Undeclared became a
WeakIdentityDictionary, #compact, which is part of what ReleaseBuilder
does, would recalculate the tally via #noCheckNoGrowFillFrom:.

So, even for weak hashed collections, tally should never be larger than
the actual capacity (not #capacity, which currently implemented as array
size is a misnomer) of the collection.


Levente

On Wed, 26 Feb 2020, marcel.taeumel wrote:

> Maybe weak collections should never claim to be empty anymore after any
> element was added to them? I would understand that since repeated calls can
> return different results.
>
> Best,
> Marcel
>
>
>
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200226/f12650f5/attachment.html>


More information about the Squeak-dev mailing list