<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hi Christoph --<div><br></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">> Do I understand correctly that you do not yet consider this good enough? :)</span><br></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">That depends on your original motivation. :-) If you want to closure a binding from an outer context, there is no need for this inline optimization in the first place.</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">Having a one-arg block in "otherwise:" only makes sense for dynamic block re-use:</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px"><br></span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">explorer := [:obj | obj explore].</span></div><div><span style="font-family: Arial, Helvetica, sans-serif;font-size: 13px">...</span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">a caseOf: cases otherwise: explorer.</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">...</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br></span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Why would I want to rename an existing binding in the static case?</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br></span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">a := 42.</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">a caseOf: cases otherwise: [a explore]. "Why [:x | x explore]?"</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">...</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px"><br></span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Best,</span></span></div><div><span style="font-family: Arial, Helvetica, sans-serif"><span style="font-size: 13px">Marcel</span></span></div><div class="mb_sig"></div>
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 22.11.2021 17:18:57 schrieb christoph.thiede@student.hpi.uni-potsdam.de <christoph.thiede@student.hpi.uni-potsdam.de>:</p><div style="font-family:Arial,Helvetica,sans-serif">
Hi Levente, Hi Marcel,<br>
<br>
currently, this expression:<br>
<br>
    <span style="color: #800000">self</span><span style="color: #000000"> </span><span style="color: #000080">assert:</span><span style="color: #000000"> </span><span style="color: #800000">42</span><span style="color: #000000"> </span><span style="color: #000080">equals:</span><span style="color: #000000"> </span><span style="color: #000000">(</span><span style="color: #800000">6</span><span style="color: #000000"> </span><span style="color: #000080">caseOf:</span><span style="color: #000000"> </span><span style="color: #000000">{</span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">a</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">b</span><span style="color: #008000">]</span><span style="color: #000000">.</span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">b</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">c</span><span style="color: #008000">]</span><span style="color: #000000">.</span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">c</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">a</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000000">}</span><span style="color: #000000"> </span><span style="color: #000080">otherwise:</span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #000000">:</span><span style="color: #000080">x</span><span style="color: #000000"> </span><span style="color: #808080">|</span><span style="color: #000000"> </span><span style="color: #000080">x</span><span style="color: #000000"> </span><span style="color: #000080">*</span><span style="color: #000000"> </span><span style="color: #800000">7</span><span style="color: #008000">]</span><span style="color: #000000">)</span><span style="color: #000000">.</span><br>
<br>
is decompiled like that:<br>
<br>
    <span style="color: #800000">self</span><span style="color: #000000"><br>
        </span><span style="color: #000080">assert:</span><span style="color: #000000"> </span><span style="color: #800000">42</span><span style="color: #000000"><br>
        </span><span style="color: #000080">equals:</span><span style="color: #000000"> </span><span style="color: #000000">(</span><span style="color: #008000">(</span><span style="color: #FF0000">x</span><span style="color: #000000"> </span><b>:=</b><span style="color: #000000"> </span><span style="color: #800000">6</span><span style="color: #008000">)</span><span style="color: #000000"> </span><span style="color: #000080">caseOf:</span><span style="color: #000000"> </span><span style="color: #000000">{</span><span style="color: #000000"><br>
                </span><span style="color: #008000">[</span><span style="color: #FF0000">a</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">b</span><span style="color: #008000">]</span><span style="color: #000000">.</span><span style="color: #000000"><br>
                </span><span style="color: #008000">[</span><span style="color: #FF0000">b</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">c</span><span style="color: #008000">]</span><span style="color: #000000">.</span><span style="color: #000000"><br>
                </span><span style="color: #008000">[</span><span style="color: #FF0000">c</span><span style="color: #008000">]</span><span style="color: #000000"> </span><span style="color: #000080">-></span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">a</span><span style="color: #008000">]</span><span style="color: #000000">}</span><span style="color: #000000"><br>
                 </span><span style="color: #000080">otherwise:</span><span style="color: #000000"> </span><span style="color: #008000">[</span><span style="color: #FF0000">x</span><span style="color: #000000"> </span><span style="color: #000080">*</span><span style="color: #000000"> </span><span style="color: #800000">7</span><span style="color: #008000">]</span><span style="color: #000000">)</span><br>
<br>
<span style="color: #FF0000">x</span> is also declared correctly in the test method. Do I understand correctly that you do not yet consider this good enough? :)<br>
<br>
Best,<br>
Christoph<br>
<br>
<span style="color: #808080">---<br>
</span><span style="color: #808080"><i>Sent from </i></span><span style="color: #808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><span style="color: #808080">Squeak Inbox Talk</span></u></a></i></span><br>
<br>
On 2021-11-18T14:04:16+01:00, marcel.taeumel@hpi.de wrote:<br>
<br>
> Hi Levente --<br>
> <br>
> Thanks. Decompiler only adds the block-arg for not-inlined caseOfs. See ObjectTest >> #testCaseOfOtherwise.<br>
> <br>
> Hmm... Christoph? =) Otherwise (ha!) I will take a look at it soon-ish.<br>
> <br>
> Best,<br>
> Marcel<br>
> Am 18.11.2021 13:51:02 schrieb Levente Uzonyi <leves at caesar.elte.hu>:<br>
> Hi Marcel,<br>
> <br>
> I just checked how this works, and noticed that the decompiler cannot<br>
> recreate the original code if the otherwise: block has an argument.<br>
> <br>
> <br>
> Levente<br>
> <br>
> On Thu, 18 Nov 2021, Marcel Taeumel wrote:<br>
> <br>
> > Merged.<br>
> ><br>
> > Am 21.02.2020 17:33:03 schrieb Thiede, Christoph :<br>
> ><br>
> > This changeset makes it possible to accept an argument in the otherwise block of a #caseOf:otherwise: call.<br>
> ><br>
> ><br>
> > Diff of the #caseOf:otherwise: implementation:<br>
> ><br>
> > caseOf: aBlockAssociationCollection otherwise: aBlock<br>
> ><br>
> > "The elements of aBlockAssociationCollection are associations between blocks.  Answer the evaluated value of the first association in aBlockAssociationCollection whose evaluated key equals the receiver.  If no<br>
> > match is found, answer the result of evaluating aBlock."<br>
> ><br>
> ><br>
> > aBlockAssociationCollection associationsDo:<br>
> ><br>
> > [:assoc | (assoc key value = self) ifTrue: [^assoc value value]].<br>
> ><br>
> > - ^ aBlock value<br>
> ><br>
> > + ^ aBlock cull: self<br>
> ><br>
> ><br>
> > "| z | z := {[#a]->[1+1]. ['b' asSymbol]->[2+2]. [#c]->[3+3]}. #b caseOf: z otherwise: [0]"<br>
> ><br>
> > "| z | z := {[#a]->[1+1]. ['d' asSymbol]->[2+2]. [#c]->[3+3]}. #b caseOf: z otherwise: [0]"<br>
> ><br>
> > "The following are compiled in-line:"<br>
> ><br>
> > "#b caseOf: {[#a]->[1+1]. ['b' asSymbol]->[2+2]. [#c]->[3+3]} otherwise: [0]"<br>
> ><br>
> > "#b caseOf: {[#a]->[1+1]. ['d' asSymbol]->[2+2]. [#c]->[3+3]} otherwise: [0]"<br>
> ><br>
> > + "#b caseOf: {[#a]->[1+1]. ['d' asSymbol]->[2+2]. [#c]->[3+3]} otherwise: [:x | x halt]"<br>
> ><br>
> ><br>
> > Furthermore, the changeset includes a necessary modification of MessageNode >> #transformCase: so that the otherwise argument can be compiled in-line.<br>
> ><br>
> > Last but not least, I wrote some tests for #caseOf:[otherwise:].<br>
> ><br>
> ><br>
> > Please review!<br>
> ><br>
> > (In a later change, it would be possible to allow arguments for the association key blocks as well. But I love short feedback loops, so let's assess this one first :-))<br>
> ><br>
> ><br>
> > Best,<br>
> ><br>
> > Christoph<br>
> ><br>
> ><br>
> ><br>
> -------------- next part --------------<br>
> An HTML attachment was scrubbed...<br>
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211118/e87b1cbc/attachment.html><br>
> <br>
> </div></blockquote></div>