<div dir="ltr">There is also a setIdentityHash: primitive that we use to set the hash of specific classes known to the VM. Not sure if it should be used besides building the kernel though.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 24, 2022 at 3:10 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div>Hi 
Clément and Marcel,</div><div><br></div><div>You are right, other use cases are supported, and there is probably no need for a separate setIdentityHash: primitive.</div><div> <br></div><div>I guess I would not have minded if the method currently called #becomForward: would have been called #becomeForwardCopyHash: (plus a big, fat comment). As it is, it is not strictly a one way become method, it is a combination method instead, and its comment does not reflect that.</div><div><br></div><div>Best,</div><div>Florin<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 24, 2022 at 3:00 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" target="_blank">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div><div id="gmail-m_3450252126352783982gmail-m_2509738972535536563__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:rgb(0,0,0);text-align:left" dir="ltr">
                                        Hi Florin, hi Clément --<div><br></div><div>yes, that's what Squeak's #becomeForward:copyHash: is for.</div><div><br></div><div>See this discussion, where the interference between #becomeForward:, copy hash, and ModificationForbidden is explained:</div><div><a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html" target="_blank"><span style="font-size:10pt">http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html</span></a><br></div><div><br></div><div>Best,</div><div>Marcel</div><div></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px">
                        <p style="color:rgb(170,170,170);margin-top:10px">Am 24.01.2022 08:04:38 schrieb Clément Béra <<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"> Hi Florin,
<br>
<br>I believe there are 2 primitives for 2 different use-cases:
<br>- primitiveArrayBecomeOneWayNoCopyHash 248
<br>- primitiveArrayBecomeOneWayCopyHash 249
<br>
<br>The difference between both is which hash is preserved. I think for your
<br>use-case you should use the other primitive.
<br>
<br>On Mon, Jan 24, 2022 at 5:04 AM Florin Mateoc <u></u>
<br>wrote:
<br>
<br>>
<br>> Hi,
<br>>
<br>> I am a bit surprised by the #becomeForward: behavior in Squeak. This is a
<br>> one way become, where the target of the operation is the receiver, which
<br>> sheds its identity/existence. Nobody points to it after the primitive
<br>> execution, so it is discarded. This understanding also conforms to the
<br>> method comment.
<br>> As such, I remember a pattern of usage in VisualAge Smalltalk, where one
<br>> way become was used as a cheap cleanup/avoidance of memory leaks, by doing
<br>> oneWayBecome: nil. It's not that I advocate for it, but this works in
<br>> Squeak too, except in Squeak #becomeForward: does an additional thing to
<br>> the pointers redirection, it changes the identityHash of the argument, the
<br>> non (obvious) target. While I understand this may be useful in certain
<br>> situations, I think it is a dangerous conflation of activities. A new
<br>> primitive that sets the identity hash could be used (VA has it) explicitly
<br>> instead when such behavior is desired.
<br>> As it is, if I do "Object new becomeForward: nil", it succeeds and it
<br>> changes nil's identityHash.
<br>>
<br>> Sorry if this has been debated before,
<br>>
<br>> Cheers,
<br>> Florin
<br>>
<br>
<br>
<br>-- 
<br>Clément Béra
<br><a href="https://clementbera.github.io/" target="_blank">https://clementbera.github.io/</a>
<br><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.com/</a>
<br><div dir="ltr">Hi Florin,<br><br>I believe there are 2 primitives for 2 different use-cases:<br>- <span style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">primitiveArrayBecomeOneWayNoCopyHash </span><span style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">248</span><div><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">- </span><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">primitiveArrayBecomeOneWayCopyHash </span><span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap">249</span></div><div><span style="color:rgb(36,41,47);font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap"><br></span></div>The difference between both is which hash is preserved. I think for your use-case you should use the other primitive.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 24, 2022 at 5:04 AM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div>Hi,</div><div><br></div><div>I am a bit surprised by the #becomeForward: behavior in Squeak. This is a one way become, where the target of the operation is the receiver, which sheds its identity/existence. Nobody points to it after the primitive execution, so it is discarded. This understanding also conforms to the method comment. <br></div><div>As such, I remember a pattern of usage in VisualAge Smalltalk, where one way become was used as a cheap cleanup/avoidance of memory leaks, by doing oneWayBecome: nil. It's not that I advocate for it, but this works in Squeak too, except in Squeak #becomeForward: does an additional thing to the pointers redirection, it changes the identityHash of the argument, the non (obvious) target. While I understand this may be useful in certain situations, I think it is a dangerous conflation of activities. A new primitive that sets the identity hash could be used (VA has it) explicitly 
<br>instead 
<br>
<br>when such behavior is desired.</div><div>As it is, if I do "Object new becomeForward: nil", it succeeds and it changes nil's identityHash.</div><div><br></div><div>Sorry if this has been debated before,</div><div><br></div><div>Cheers,</div><div>Florin<br></div></div>
<br></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Clément Béra<br></span><span style="color:rgb(0,0,238)"><a href="https://clementbera.github.io/" target="_blank">https://clementbera.github.io/</a></span><div style="font-size:12.8px"><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.com/</a></div></div></div></div></div></div>
<br><u></u></div></blockquote>
                                        </div></div></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Clément Béra<br></span><span style="color:rgb(0,0,238)"><a href="https://clementbera.github.io/" target="_blank">https://clementbera.github.io/</a></span><div style="font-size:12.8px"><a href="https://clementbera.wordpress.com/" target="_blank">https://clementbera.wordpress.com/</a></div></div></div></div></div></div>