<div dir="ltr">Hi Chris,<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 20, 2017 at 2:26 PM, Chris Muller <span dir="ltr"><<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">>>> The former is technically impossible due to different object<br>
>>> representations, the latter is possible and not restricted at all. For<br>
>>> example, true and false are not immediate objects, you can use #become*: on<br>
>>> them to blow your image up.<br>
>>> So, there's no restriction at all if it's technically possible to use<br>
>>> #become*:.<br>
>>> The responsibility model is the simplest here: use at your own risk.<br>
>>> Since this comes up every once in a while, I suggest a comment be added<br>
>>> to those methods stating the responsibility model explicitly.<br>
>><br>
>><br>
>> +1<br>
<br>
</span>Why express +1 for the responsibility model for use of become: (which<br>
I agree with), but not for mutating objects?<br>
<span class=""><br>
>> *Especially* a warning that becomeForward: does modify the target's hash.<br>
<br>
</span>I assume this is not referring to a Warning signal here, but just<br>
something in the comment.  But even that wouldn't be necessary as long<br>
as the indirection remains, since the "copyHash: false" code makes<br>
that very clear.<br>
<span class=""><br>
>>> I don't know how the VM handles immutability in this case, but it's<br>
>>> possible that it wouldn't let #become*: affect immutable objects.<br>
>><br>
>> I think that would be fine, you should be able to become an immutable<br>
>> object and vice versa.<br>
>><br>
>>><br>
>>> On the other hand, I'm sure it would let you change fields of immutable<br>
>>> objects via #become*:, but that's not an issue in your case.<br>
>><br>
>><br>
>> This is debatable ... I would rather have the VM raise an error when<br>
>> trying to become a field of an immutable object. Immutable should mean<br>
>> immutable, no?<br>
<br>
</span>So for bulkBecome:, will the error mean it becomed some of them (the<br>
ones that that could), but not all?   It's getting complex!<br></blockquote><div><br></div><div>None of them.  The semantics of primitives should be they either succeed and answer their result, or they fail without side-effects.  Alas the ImageSegment loading primitive is an exception, but I believe it's the only one.  So in the become primitives, validation is done before any becomes, including computing an estimate of any memory needed, and the entire bulk become will fail if any single object fails validation and/or if there is not enough memory to complete the operation (two-way become may involve creating copies of objects).</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> However, it seems to me that becomerForward: doing a copyHash is itself a<br>
> bug.  What's the rationale for copying the receiver's hash to the target<br>
> object?<br>
<br>
</span>For when you become a Proxy object to a Symbol selector to perform,<br>
which are keys in MethodDictionary's.  It's absolutely essential.<br></blockquote><div><br></div><div>This doesn't make sense to me.  Are you saying one has a proxy for a Symbol that is not present, this gets entered as a key into MethodDictionaries, and later is becalmed into the Symbol it represents?  If not, can you take me through the use-case?</div><div><br></div><div>It seems to me that what one wants is the ability to determine an Object's identityHash.  I've long thought that Symbols should set their identityHash on creation so that Symbols identityHashes are constant across all systems.  This would men for example, that binary code loaders would not need to rehash method dictionaries because they would already be correctly hashed.  In these cases one definitely doesn't want to overwrite the target's identityHash; instead, taking your example, one would want to create the proxy with the identityHash of its target.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Best,<br>
  Chris<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>