<div dir="ltr">I checked and the exception handling mechanism is not affected by a non-local return in an exception handler, it works fine.<div>I think that having a non local return in an exc. handler is really handy and I do not see the problem with that really. Of course that people can make mistakes but that is related to not using non local returns correctly, not to doing it in the exc. handler.</div><div>The #return:, #pass, etc. do no have the same behavior as having a non local return... with this change if I want to return from the method when handling an exception a special object will have to be returned and the a check with an if for it will be needed.</div><div><br></div><div>I think this change is a step backwards really, it makes things harder for handler you want to return from the method and having a non local return does not harm how exceptions work. </div><div><br></div><div>Hernan.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 13, 2019 at 5:12 PM Andres Valloud via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</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">The conversation that led to these changes went more or less like <br>
this... first, I noted that exception handlers that look like this:<br>
<br>
[:ex | ^5]<br>
<br>
are asking for trouble, because:<br>
<br>
a) effectively, nobody is looking at how the exception handling <br>
mechanism is implemented, so doing non-local return like that curtails <br>
the private implementation of exception handling,<br>
<br>
b) that kind of behavior is what the messages #return, #resume, #pass, <br>
#outer, etc are there for,<br>
<br>
c) when you need to debug why exceptions are behaving a certain way, the <br>
above exception handlers make debugging impossible because now there's <br>
no place to put a breakpoint (e.g. in #return, #resume, #pass, #outer, <br>
etc, which can be redefined for the purpose at hand in the single <br>
exception of interest), and finally,<br>
<br>
d) it's possible to distort the exception handling mechanism behavior <br>
with non-local returns.<br>
<br>
<br>
The vast majority of the time, I see exception handlers with non-local <br>
returns as very close to expressions such as these:<br>
<br>
#(1 2 3) asSortedCollection: [:x :y | ^x < y]<br>
<br>
where the behavior you get is not what you expected, even though the <br>
code is doing exactly what was requested. See attached for an actual <br>
example of what I mean. To run the code, do these and see what happens.<br>
<br>
ExceptionExample new breakingStuff<br>
ExceptionExample new workingStuff<br>
<br>
To me, generally speaking, these considerations push the scales against <br>
the apparent convenience of having exception handlers do a non-local <br>
return. I do not want to have to debug that kind of convenience under <br>
time pressure. I do not even want to have to change code that uses such <br>
convenience, because it's going to be more difficult than otherwise.<br>
<br>
<br>
So Juan heard this and pointed out the reasoning is lovely but it's not <br>
that helpful because the system is doing nothing to make users aware of <br>
these facts. He suggested the system should complain instead. Thus we <br>
(although he says mostly I) wrote code that detects non-local return and <br>
complains. I believe that code was integrated recently (this bit, he <br>
did on his own LOL).<br>
<br>
Andres.<br>
<br>
On 10/13/19 07:52, Hernan Wilkinson wrote:<br>
> Could you provide the case were it generates problems?<br>
> <br>
> On Sun, Oct 13, 2019 at 11:40 AM Hernan Wilkinson <br>
> <<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a> <mailto:<a href="mailto:hernan.wilkinson@10pines.com" target="_blank">hernan.wilkinson@10pines.com</a>>> wrote:<br>
> <br>
> Hi,<br>
> I think that forbidden a non local return in an exception handler<br>
> is not really the solution... Although I understand the motivation I<br>
> think that changing the exception handling mechanism would be better.<br>
> I'm going to take a look at it to see if it is possible to do it.<br>
> <br>
> Hernan.<br>
> <br>
> On Sun, Oct 13, 2019 at 10:48 AM Juan Vuletich via Cuis-dev<br>
> <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>> wrote:<br>
> <br>
> Hi Folks,<br>
> <br>
> Some time ago, Andrés (with just a tad of help from me) fixed a<br>
> problem<br>
> in Exception handling. If exception handler blocks do non-local<br>
> return<br>
> (^stuff), they will skip execution of part of the Exception<br>
> handling<br>
> system code, breaking exception return values and possibly other<br>
> 'bad<br>
> things'.<br>
> <br>
> I just pushed to GitHub a few updates with this work. Now, if an<br>
> exception handler does a non-local return, an Error will be<br>
> raised. We<br>
> also fixed a couple of places in the image where this was being<br>
> done.<br>
> BaseImageTests pass.<br>
> <br>
> This updates have some risk of breaking your code. If you you<br>
> get this<br>
> error: 'Exception handler blocks must not do non local returns',<br>
> then<br>
> you need to adjust your code. See updates #3917 to #3922 for the<br>
> changes<br>
> done to the base image.<br>
> <br>
> Thanks,<br>
> <br>
> -- <br>
> Juan Vuletich<br>
> <a href="http://www.cuis-smalltalk.org" rel="noreferrer" target="_blank">www.cuis-smalltalk.org</a> <<a href="http://www.cuis-smalltalk.org" rel="noreferrer" target="_blank">http://www.cuis-smalltalk.org</a>><br>
> <a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" rel="noreferrer" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a><br>
> <a href="https://github.com/jvuletich" rel="noreferrer" target="_blank">https://github.com/jvuletich</a><br>
> <a href="https://www.linkedin.com/in/juan-vuletich-75611b3" rel="noreferrer" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a><br>
> @JuanVuletich<br>
> <br>
> -- <br>
> Cuis-dev mailing list<br>
> <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a> <mailto:<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a>><br>
> <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
> <br>
> <br>
> <br>
> -- <br>
> *Hernán Wilkinson<br>
> Agile Software Development, Teaching & Coaching*<br>
> *Phone: +54-011*-4893-2057<br>
> *Twitter: @HernanWilkinson*<br>
> *site: <a href="http://www.10Pines.com" rel="noreferrer" target="_blank">http://www.10Pines.com</a> <<a href="http://www.10pines.com/" rel="noreferrer" target="_blank">http://www.10pines.com/</a>>*<br>
> Address: Alem 896, Floor 6, Buenos Aires, Argentina<br>
> <br>
> <br>
> <br>
> -- <br>
> *Hernán Wilkinson<br>
> Agile Software Development, Teaching & Coaching*<br>
> *Phone: +54-011*-4893-2057<br>
> *Twitter: @HernanWilkinson*<br>
> *site: <a href="http://www.10Pines.com" rel="noreferrer" target="_blank">http://www.10Pines.com</a> <<a href="http://www.10pines.com/" rel="noreferrer" target="_blank">http://www.10pines.com/</a>>*<br>
> Address: Alem 896, Floor 6, Buenos Aires, Argentina<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal"><span style="font-weight:bold">Hernán Wilkinson</span><br>Agile Software Development, Teaching & Coaching</span></font></span></span></span></strong></span></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div><div><strong style="font-family:tahoma,sans-serif;font-size:xx-small"><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Twitter: @HernanWilkinson</span></font></span></span></strong></div><div><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span><span style="font-size:small"><font size="2"><span style="font-weight:normal">site: <a href="http://www.10pines.com/" style="color:rgb(17,65,112)" target="_blank">http://www.10Pines.com</a></span></font></span></span></span></strong></span></div><div><font face="tahoma, sans-serif"><span style="border-collapse:collapse">Address: Alem 896</span></font>, Floor 6, Buenos Aires, Argentina</div></div></div></div></div></div></div></div></div></div></div></div>