<div dir="ltr"><a href="http://source.squeak.org/trunk/Compiler-nice.189.diff">http://source.squeak.org/trunk/Compiler-nice.189.diff</a> with the help of Eliot :)<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 17 mai 2019 à 19:32, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<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"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 17 mai 2019 à 19:20, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<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">Hi Torge,</div><div>considering that I'm probably the one who made cascading work for inlined messages, I'm happy enough with your suggestion ;)</div><div><a href="https://marc.info/?l=squeak-dev&m=123180721604241&w=2" target="_blank">https://marc.info/?l=squeak-dev&m=123180721604241&w=2</a></div><div><br></div><div>I thought I once proposed some Compiler changes to make the cacaded inlined message still optimized, but I can't find them anymore.</div><div>It was rejected as overkill (two many changes for so few value)<br></div></div></blockquote><div>if couse, it was not two, but many more, too many <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></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 17 mai 2019 à 18:08, Torge Husfeldt <<a href="mailto:torge.husfeldt@gmx.de" target="_blank">torge.husfeldt@gmx.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Subbu, <br>
see, I forgot about the good old simple parantheses. As I said, rusty.<br>
I’d say, if we don’t reach unanimity regarding the new selectors, this shortcut should fit the bill for your initial request?<br>
<br>
Von meinem iPhone gesendet<br>
<br>
> Am 17.05.2019 um 13:02 schrieb K K Subbu <<a href="mailto:kksubbu.ml@gmail.com" target="_blank">kksubbu.ml@gmail.com</a>>:<br>
> <br>
> This also works:<br>
> <br>
> ('isBoolean' beginsWith: 'is') ifTrue: [Display flash: World bounds]; yourself<br>
> <br>
> Regards .. Subbu<br>
> <br>
>> On 16/05/19 8:43 PM, Torge Husfeldt wrote:<br>
>> Hi Nico,<br>
>> I'm convinced this only works without the extra [] value because you chose a special selector. For keyword-selector it should go to "self".<br>
>> Which part exactly is not optimized? The "ifTrue:" has a special handling in the bytecode complier, and iirc yourself is also not "actually sent".<br>
>> Cdlt<br>
>> Torge<br>
>>> On 16.05.19 17:08, Nicolas Cellier wrote:<br>
>>> Hi,<br>
>>> Ah yes, it works, no need for extra [] value<br>
>>> <br>
>>>     (3 > 2) ifTrue: [Transcript cr; show: 'bingo!']; yourself<br>
>>> <br>
>>> The code is not optimized, but it works.<br>
>>> <br>
>>> Le jeu. 16 mai 2019 à 16:52, Torge Husfeldt <<a href="mailto:torge.husfeldt@gmx.de" target="_blank">torge.husfeldt@gmx.de</a> <mailto:<a href="mailto:torge.husfeldt@gmx.de" target="_blank">torge.husfeldt@gmx.de</a>>> a écrit :<br>
>>> <br>
>>>    Salut Nico,<br>
>>> <br>
>>>    please excuse if my squeak knowlege is a bit rusty, but wouldn't<br>
>>>    this do the job:<br>
>>> <br>
>>>    self findlast: [:each |<br>
>>> <br>
>>>    [self testSomeConditionFor: each] value ifTrue:[self<br>
>>>    performSomeAction:each]; yourself.<br>
>>> <br>
>>>    ].<br>
>>> <br>
>>>    Just an idea. And very sad that I have to wrap the condition in a<br>
>>>    block, but I guess othewise the recipient for "yourself" would be<br>
>>>    "self"<br>
>>> <br>
>>>>    On 14.05.19 17:02, Nicolas Cellier wrote:<br>
>>>>    Oups, my example was a bit stupid because findLast: loop stops at<br>
>>>>    first true, but you get my intention...<br>
>>>>    Replace with select:/reject: or provide a whenFalse: side effect...<br>
>>>> <br>
>>>>    Le mar. 14 mai 2019 à 16:23, Nicolas Cellier<br>
>>>>    <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a><br>
>>>>    <mailto:<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>>> a écrit :<br>
>>>> <br>
>>>>        Hi,<br>
>>>>        From time to time, I need to perform some additional action<br>
>>>>        (side effect) when a boolean is true, but preserve that<br>
>>>>        boolean as return value.<br>
>>>> <br>
>>>>        Here is a pseudo example:<br>
>>>> <br>
>>>>            self findLast: [:each |<br>
>>>>                | conforming |<br>
>>>>                conforming := self testSomeConditionFor: each.<br>
>>>>                conforming<br>
>>>>                    ifTrue:<br>
>>>>                        [ "found one, do some side effect before<br>
>>>>        searching next"<br>
>>>>                        self performSomeAction: each ].<br>
>>>>                 conforming ].<br>
>>>> <br>
>>>>        Or shorter, but I dislike the redundant true:<br>
>>>> <br>
>>>>            self findLast: [:each |<br>
>>>>                (self testSomeConditionFor: each)<br>
>>>>                    and:<br>
>>>>                        [ "found one, do some side effect before<br>
>>>>        searching next"<br>
>>>>                        self performSomeAction: each.<br>
>>>>                        true ]].<br>
>>>> <br>
>>>>        What i seek is even shorter:<br>
>>>> <br>
>>>>            self findLast: [:each |<br>
>>>>                (self testSomeConditionFor: each)<br>
>>>>                    whenTrue:<br>
>>>>                        [ "found one, do some side effect before<br>
>>>>        searching next"<br>
>>>>                        self performSomeAction: each ]].<br>
>>>> <br>
>>>>        Of course, we would have companions whenFalse:,<br>
>>>>        whenTrue:whenFalse:...<br>
>>>>        Would you buy it?<br>
>>>> <br>
>>>> <br>
>>>> <br>
>>> <br>
>>> <br>
> <br>
<br>
<br>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div>