<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Stéphane,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">    WeakIdentityDictionary is not the same as WeakKeyIdentityDictionary.  Read the class comments.  WeakIdentityDictionary refers to its *associations* weakly.  Since there are no references to the associations in your dictionary they get GC'ed immediately and you see no contents.  I'm guessing that WeakKeyIdentityDictionary is what you want.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 23, 2022 at 6:01 AM Stéphane Rollandin <<a href="mailto:lecteur@zogotounga.net">lecteur@zogotounga.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hello all,<br>
<br>
I noticed that a WeakIdentityDictionary does not hold literal values.<br>
For example, in a workspace:<br>
<br>
        wd := WeakIdentityDictionary new.<br>
        wd at: #foo put: 42.<br>
        wd at: #bar put: #foo.<br>
<br>
        wd "printIt ->"  a WeakIdentityDictionary()<br>
<br>
On the other hand, WeakSet does hold literals<br>
<br>
        ws := WeakSet new.<br>
        ws add: #foo.<br>
        ws add: 42.<br>
<br>
        ws "printIt ->" a WeakSet(#foo 42)<br>
<br>
And also WeakKeyDictionary<br>
<br>
        wk := WeakKeyDictionary new.<br>
        wk at: #foo put: 42.<br>
        wk at: #bar put: #foo.<br>
<br>
        wk "printIt ->"  a WeakKeyDictionary(#bar->#foo #foo->42 )<br>
<br>
<br>
Is this the intended behavior? What is the semantics here?<br>
<br>
Stef<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>