<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Levente,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 14, 2020 at 12:52 PM Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu">leves@caesar.elte.hu</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">Hi Eliot,<br>
<br>
On Tue, 14 Apr 2020, Eliot Miranda wrote:<br>
<br>
><br>
><br>
>> On Apr 14, 2020, at 6:40 AM, Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br>
>> <br>
>> Hi Marcel,<br>
>> <br>
>> That's a bug. The argument of #becomeForward: is never attempted to be modified. The following should work:<br>
>> <br>
>> | a |<br>
>> a := Object new.<br>
>> a becomeForward: #foo.<br>
>> self assert: a = 'foo'.<br>
>> <br>
>> The error it raises is nonsense.<br>
><br>
> +1<br>
<br>
Well, the thing is that #becomeForward: tries to copy the identityHash too<br>
hence the error. I'm not sure whether PrimErrInapropriate is the right <br>
choice but that's what the code produces and it matches what the comment <br>
of SpurMemoryManager >> #containsOnlyValidBecomeObjects:and:twoWay:copyHash:<br>
states. IMHO PrimErrNoModification would be more appropriate in this case.<br>
<br>
So, the presence of the error is expected. The correct code is:<br>
<br>
| a |<br>
a := Object new.<br>
a becomeForward: #foo copyHash: false.<br>
self assert: a = #foo.<br>
<br>
Which works as expected.<br></blockquote><div><br></div><div>Right.  A couple of questions are</div><div>1. what the f**k are become: becomeForward: becomeForward:copyHash: et al doing in ProtoObject?  (IMO, they should be in Object and have no business being in ProtoObject whatsoever).</div><div>2. whether becomeForward: should do copyHash: true by default.  This seems wrong to me, and implementing is as copyHash: false makes more sense.  But I'm wondering if there are important use cases.  Vanessa, any recollections on this?</div><div><br></div><div>But the VM bug is here in SpurMemoryManager>>containsOnlyValidBecomeObjects:and:twoWay:copyHash:</div><div><br></div><div><div>    (copyHash and: [(self isImmediate: oop2) or: [self isImmutable: oop2]]) ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>[^PrimErrInappropriate].</div></div><div><br></div><div>it should read something like</div><div><div>    copyHash ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>[(self isImmediate: oop2) ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>[^PrimErrInappropriate].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>(self isImmutable: oop2) ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">               </span>[^PrimErrNoModification]].</div></div><div><br></div><div>I'll make it so.</div><div><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">Levente<br>
<br>
><br>
>> <br>
>> <br>
>> Levente<br>
>> <br>
>>> On Tue, 14 Apr 2020, Marcel Taeumel wrote:<br>
>>> <br>
>>> Hi, all!<br>
>>> I suppose that since ModificationForbidden and read-only objects, the following is no longer possible:<br>
>>> MyExternalResource allInstancesDo: [:resource |<br>
>>>    resource becomeForward: #notAvailable].<br>
>>> What to do now? Introduce a custom, mutable, placeholder object instead?<br>
>>> Best,<br>
>>> Marcel<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></div></div></div></div></div>