<div dir="ltr"><div>Hi Vanessa and Marcel,</div><div><br></div><div>Thank you for clarifying. <br></div><div>Indeed, my notion of a recent image was a "current release" 5.3 image from a year and a half ago, which does not have the change, so I was indeed referring to primitive 72.</div><div><br></div><div>Sorry for the confusion,</div><div><br></div><div>Florin<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 25, 2022 at 1:29 PM Vanessa Freudenberg <<a href="mailto:vanessa@codefrau.net">vanessa@codefrau.net</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 dir="ltr"><div>@Florin,</div><div><br></div><div>I think nobody has mentioned yet that the behavior of Object>>becomeForward: in Squeak changed "recently". </div><div><br></div><div>What you were describing is the behavior of primitive 72, which indeed modified the argument's identity hash.</div><div><br></div><div>More recent Squeak releases use primitive 248 instead, which does not modify the target's hash. We also introduced primitive 249 which takes a boolean argument to indicate hash copying.</div><div><br></div><div>@Marcel: I think the comments might be more helpful if they explicitly mentioned which collections might have to be rehashed, and which (if any) object is being modified.<br></div><div><br></div></div><div dir="auto">Vanessa</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 25, 2022 at 03:44 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_4730209697692781510gmail-m_-3225879545557371912m_-4744685272161611953__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;text-align:left;color:rgb(0,0,0)" dir="ltr">
                                        Hi Florin --<div style="font-family:Arial"><br></div><div style="font-family:Arial">> <span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">it changes the identityHash of the argument, the </span><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">non (obvious) target.</span><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"> </span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px">I updated the comment in #becomeForward: ... hope it helps:</span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-family:Arial"><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:13px;font-family:Arial,Helvetica,sans-serif">"Primitive. All variables in the entire system that used to point to the receiver now point to the argument. Fails if either argument is an immediate such as a SmallInteger, or if the receiver is read-only.</span></span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:13px;font-family:Arial,Helvetica,sans-serif"><span style="white-space:pre-wrap;font-family:Arial,Helvetica,sans-serif">     </span>NOTE THAT the identityHash of the receiver IS NOT copied to the argument so that the argument should still be properly indexed in any existing hashed structures after the mutation. See #becomeForward:copyHash:."</span></span></div></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:13px;font-family:Arial,Helvetica,sans-serif"><br></span></span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:13px;font-family:Arial,Helvetica,sans-serif">Best,</span></span></div><div style="font-family:Arial"><span style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:13px;font-family:Arial,Helvetica,sans-serif">Marcel</span></span></div><div style="font-family:Arial"></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;font-family:Arial"></blockquote></div></div><div><div id="gmail-m_4730209697692781510gmail-m_-3225879545557371912m_-4744685272161611953__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;text-align:left;color:rgb(0,0,0)" dir="ltr"><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;font-family:Arial">
                        <p style="margin-top:10px;font-family:Arial;color:rgb(170,170,170)">Am 24.01.2022 15:11:09 schrieb Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" style="font-family:Arial" target="_blank">florin.mateoc@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"> Hi Clément and Marcel,
<br>
<br>You are right, other use cases are supported, and there is probably no need
<br>for a separate setIdentityHash: primitive.
<br>
<br>I guess I would not have minded if the method currently called
<br>#becomForward: would have been called #becomeForwardCopyHash: (plus a big,
<br>fat comment). As it is, it is not strictly a one way become method, it is a
<br>combination method instead, and its comment does not reflect that.
<br>
<br>Best,
<br>Florin
<br>
<br>
<br>On Mon, Jan 24, 2022 at 3:00 AM Marcel Taeumel <u style="font-family:Arial,Helvetica,sans-serif"></u>
<br>wrote:
<br>
<br>>
<br>> Hi Florin, hi Clément --
<br>>
<br>> yes, that's what Squeak's #becomeForward:copyHash: is for.
<br>>
<br>> See this discussion, where the interference between #becomeForward:, copy
<br>> hash, and ModificationForbidden is explained:
<br>>
<br>> <a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html" style="font-family:Arial,Helvetica,sans-serif" target="_blank">http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html</a>
<br>>
<br>> Best,
<br>> Marcel
<br>>
<br>> Am 24.01.2022 08:04:38 schrieb Clément Béra <u style="font-family:Arial,Helvetica,sans-serif"></u>:
<br>> 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
<br>> wrote:
<br>>
<br>> >
<br>> > Hi,
<br>> >
<br>> > I am a bit surprised by the #becomeForward: behavior in Squeak. This is
<br>> 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
<br>> 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,
<br>> 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)
<br>> 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/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.github.io/</a>
<br>> <a href="https://clementbera.wordpress.com/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.wordpress.com/</a>
<br>> 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 style="font-family:Arial,Helvetica,sans-serif"></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
<br>>>
<br>>> 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/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.github.io/</a>
<br>> <a href="https://clementbera.wordpress.com/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.wordpress.com/</a>
<br>>
<br>>
<br><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div style="font-family:Arial,Helvetica,sans-serif">Hi 
<br>Clément and Marcel,</div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">You are right, other use cases are supported, and there is probably no need for a separate setIdentityHash: primitive.</div><div style="font-family:Arial,Helvetica,sans-serif"> <br></div><div style="font-family:Arial,Helvetica,sans-serif">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 style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">Best,</div><div style="font-family:Arial,Helvetica,sans-serif">Florin<br></div><div style="font-family:Arial,Helvetica,sans-serif"><br></div></div><br><div class="gmail_quote" style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr" class="gmail_attr" style="font-family:Arial,Helvetica,sans-serif">On Mon, Jan 24, 2022 at 3:00 AM Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de" style="font-family:Arial,Helvetica,sans-serif" 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;font-family:Arial,Helvetica,sans-serif"> <div style="font-family:Arial,Helvetica,sans-serif"><div id="gmail-m_4730209697692781510gmail-m_-3225879545557371912m_-4744685272161611953gmail-m_2509738972535536563__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;text-align:left;color:rgb(0,0,0)" dir="ltr">
<br>                                        Hi Florin, hi Clément --<div style="font-family:Arial"><br></div><div style="font-family:Arial">yes, that's what Squeak's #becomeForward:copyHash: is for.</div><div style="font-family:Arial"><br></div><div style="font-family:Arial">See this discussion, where the interference between #becomeForward:, copy hash, and ModificationForbidden is explained:</div><div style="font-family:Arial"><a href="http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html" style="font-family:Arial" target="_blank"><span style="font-size:10pt;font-family:Arial">http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-April/208596.html</span></a><br></div><div style="font-family:Arial"><br></div><div style="font-family:Arial">Best,</div><div style="font-family:Arial">Marcel</div><div style="font-family:Arial"></div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-top:20px;margin-left:0px;padding-left:10px;font-family:Arial">
<br>                        <p style="margin-top:10px;font-family:Arial;color:rgb(170,170,170)">Am 24.01.2022 08:04:38 schrieb Clément Béra <<a href="mailto:bera.clement@gmail.com" style="font-family:Arial" target="_blank">bera.clement@gmail.com</a>>:</p><div style="font-family:Arial,Helvetica,sans-serif"> Hi Florin,
<br><br>
<br><br>I believe there are 2 primitives for 2 different use-cases:
<br><br>- primitiveArrayBecomeOneWayNoCopyHash 248
<br><br>- primitiveArrayBecomeOneWayCopyHash 249
<br><br>
<br><br>The difference between both is which hash is preserved. I think for your
<br><br>use-case you should use the other primitive.
<br><br>
<br><br>On Mon, Jan 24, 2022 at 5:04 AM Florin Mateoc <u style="font-family:Arial,Helvetica,sans-serif"></u>
<br><br>wrote:
<br><br>
<br><br>>
<br><br>> Hi,
<br><br>>
<br><br>> I am a bit surprised by the #becomeForward: behavior in Squeak. This is a
<br><br>> one way become, where the target of the operation is the receiver, which
<br><br>> sheds its identity/existence. Nobody points to it after the primitive
<br><br>> execution, so it is discarded. This understanding also conforms to the
<br><br>> method comment.
<br><br>> As such, I remember a pattern of usage in VisualAge Smalltalk, where one
<br><br>> way become was used as a cheap cleanup/avoidance of memory leaks, by doing
<br><br>> oneWayBecome: nil. It's not that I advocate for it, but this works in
<br><br>> Squeak too, except in Squeak #becomeForward: does an additional thing to
<br><br>> the pointers redirection, it changes the identityHash of the argument, the
<br><br>> non (obvious) target. While I understand this may be useful in certain
<br><br>> situations, I think it is a dangerous conflation of activities. A new
<br><br>> primitive that sets the identity hash could be used (VA has it) explicitly
<br><br>> instead when such behavior is desired.
<br><br>> As it is, if I do "Object new becomeForward: nil", it succeeds and it
<br><br>> changes nil's identityHash.
<br><br>>
<br><br>> Sorry if this has been debated before,
<br><br>>
<br><br>> Cheers,
<br><br>> Florin
<br><br>>
<br><br>
<br><br>
<br><br>-- 
<br><br>Clément Béra
<br><br><a href="https://clementbera.github.io/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.github.io/</a>
<br><br><a href="https://clementbera.wordpress.com/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.wordpress.com/</a>
<br><br><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif">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 style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap;color:rgb(36,41,47)">- </span><span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap;color:rgb(36,41,47)">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 style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:12px;white-space:pre-wrap;color:rgb(36,41,47)"><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" style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr" class="gmail_attr" style="font-family:Arial,Helvetica,sans-serif">On Mon, Jan 24, 2022 at 5:04 AM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" style="font-family:Arial,Helvetica,sans-serif" 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;font-family:Arial,Helvetica,sans-serif"> <div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div style="font-family:Arial,Helvetica,sans-serif">Hi,</div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">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 style="font-family:Arial,Helvetica,sans-serif">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><br>instead 
<br><br>
<br><br>when such behavior is desired.</div><div style="font-family:Arial,Helvetica,sans-serif">As it is, if I do "Object new becomeForward: nil", it succeeds and it changes nil's identityHash.</div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">Sorry if this has been debated before,</div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">Cheers,</div><div style="font-family:Arial,Helvetica,sans-serif">Florin<br></div></div>
<br><br></blockquote></div><br clear="all"><div style="font-family:Arial,Helvetica,sans-serif"><br></div>-- <br><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><span style="font-size:12.8px;font-family:Arial,Helvetica,sans-serif">Clément Béra<br></span><span style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,0,238)"><a href="https://clementbera.github.io/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.github.io/</a></span><div style="font-size:12.8px;font-family:Arial,Helvetica,sans-serif"><a href="https://clementbera.wordpress.com/" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://clementbera.wordpress.com/</a></div></div></div></div></div></div>
<br><br><u style="font-family:Arial,Helvetica,sans-serif"></u></div></blockquote>
<br>                                        </div></div></blockquote></div>
<br><u style="font-family:Arial,Helvetica,sans-serif"></u><u style="font-family:Arial,Helvetica,sans-serif"></u><u style="font-family:Arial,Helvetica,sans-serif"></u></div></blockquote>
                                        </div></div></blockquote></div></div>
</div>
</blockquote></div>