Hi Eliot, Hi all,<br>
<br>
the following snippet returns an unexpected result to me cross-platform (tested with 202112201228 on Win 21H1 and WSL/Ubuntu 18.04):<br>
<br>
<font color="#000000">    </font><font color="#000000">ProtoObject</font><font color="#000000"> </font><font color="#000080">tryPrimitive:</font><font color="#000000"> </font><font color="#800000">75</font><font color="#000000"> </font><font color="#000080">withArgs:</font><font color="#000000"> </font><font color="#000080">#</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">.</font><font color="#000000"><br>
    </font><font color="#800000">thisContext</font><font color="#000000"> </font><font color="#000080">objectClass:</font><font color="#000000"> </font><font color="#000000">ProtoObject</font><font color="#000000"> </font><font color="#000080">basicNew</font><font color="#000000">.</font><font color="#000000"> </font><font color="#008080">"nil"</font><br>
<br>
The example needs to be run in a fresh image. If primitiveBehaviorHash was sent to ProtoObject before, the bug does not occur:<br>
<br>
<font color="#000000">    </font><font color="#000000">ProtoObject</font><font color="#000000"> </font><font color="#000080">tryPrimitive:</font><font color="#000000"> </font><font color="#800000">175</font><font color="#000000"> </font><font color="#000080">withArgs:</font><font color="#000000"> </font><font color="#000080">#</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">.</font><font color="#000000"><br>
    </font><font color="#000000">ProtoObject</font><font color="#000000"> </font><font color="#000080">tryPrimitive:</font><font color="#000000"> </font><font color="#800000">75</font><font color="#000000"> </font><font color="#000080">withArgs:</font><font color="#000000"> </font><font color="#000080">#</font><font color="#000000">(</font><font color="#000000">)</font><font color="#000000">.</font><font color="#000000"><br>
    </font><font color="#800000">thisContext</font><font color="#000000"> </font><font color="#000080">objectClass:</font><font color="#000000"> </font><font color="#000000">ProtoObject</font><font color="#000000"> </font><font color="#000080">basicNew</font><font color="#000000">.</font><font color="#000000"> </font><font color="#008080">"ProtoObject"</font><br>
<br>
I'm not sure whether this should be classified as a bug. On the one hand, the name and the implementors of primitiveIdentityHash make pretty clear that one should not invoke it with a behavior. On the other hand, incidents like this make the usage of primitives extremely hard.<br>
I was writing a mirror primitive method that used primitiveIdentityHash in the first run and only falled back to primitiveBehaviorHash if the former failed [1]. Imagine how many hours it took me to trace a larger segfaulting test suite back to this unexpected behavior of primitiveClass. :-)<br>
In my expectation, primitiveIdentityHash should consequently fail for unappropriate receivers. However, I have fixed my mirror implementation now and only wanted to let you know about this observation.<br>
<br>
Best,<br>
Christoph<br>
<br>
[1] Pointer if you want to read up to bloody details by yourself: <a href="https://github.com/LinqLover/SimulationStudio/pull/34/commits/0a55a8a23b6e842548049c07cbd96120a30cd06e">https://github.com/LinqLover/SimulationStudio/pull/34/commits/0a55a8a23b6e842548049c07cbd96120a30cd06e</a><br>
<br>
<font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font>