<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Calibri Light";
        panose-1:2 15 3 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Calibri Light \,sans-serif\;";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoNoSpacing, li.MsoNoSpacing, div.MsoNoSpacing
        {mso-style-priority:1;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        color:black;}
p.m-1962667289679495542msonospacing, li.m-1962667289679495542msonospacing, div.m-1962667289679495542msonospacing
        {mso-style-name:m_-1962667289679495542msonospacing;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Juan,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">this is the latest Squeak trunk version replacing all duplicate unwind code with #unwindTo:safely: (sent already as part of the other changeset with #terminate).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The modified version of #unwindTo: just adds a Boolean distinguishing between the "old" unwind semantics, i.e. only evaluating unwind blocks that haven't started executing yet, and the "new" unwind semantics applied in #terminate (safely:
 true enables the new semantics).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As a bonus we can experiment with setting safely: true even for "normal" returns, extending the unwind semantics for non-local returns and exceptions. It's more or less working but haven't been tested properly so this is my project for
 later this year :)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best regards,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Jaromir</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNoSpacing"><span lang="CS">--</span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;color:#333333;font-weight:normal">Jaromír Matas</span></strong><span style="font-family:"Calibri Light",sans-serif;color:#555555"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="font-family:"Calibri Light",sans-serif;color:#2E75B6">mail@jaromir.net<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:cuis-dev@lists.cuis.st">Jaromir Matas via Cuis-dev</a><br>
<b>Sent: </b>Friday, February 24, 2023 12:50<br>
<b>To: </b><a href="mailto:juan@cuis.st">Juan Vuletich</a>; <a href="mailto:cuis-dev@lists.cuis.st">
Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:mail@jaromir.net">Jaromir Matas</a>; <a href="mailto:hernan.wilkinson@10pines.com">
Hernán Wilkinson</a><br>
<b>Subject: </b>Re: [Cuis-dev] Code duplication around unwinding</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Juan,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> I think this is a good idea, and I agree with the desire to go back to the older Squeak design. However, I don't know why it was made more complicated. It would be good to understand the rationale behind those changes, unless we can be
 sure that the behavior is identical.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Precisely, I'm trying to understand *why* the changes were made first. I hoped you might remember something :) No feedback from Squeak, the authors behind the rewrite are probably no longer following the forum. However, I've made the first
 step in Squeak and replaced the duplicate code with unwindTo: because it very much looks like a copy/paste issue as Hernan suggested :) All tests work fine and the semantics is identical as before. It's in Squeak trunk and so far no problems reported. I'll
 send you the same cleaned up version as in Squeak.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As part of the effort I discussed the purpose of ContextPart #terminateTo: method that's being used in #resume{...] methods as part of the unwind procedure. My conclusion is we *must* use #terminateTo because a similar code is used inside
 the VM to process non-local returns without any unwind blocks present. The real rationale behind the #terminateTo code however, is to prevent any contexts that were "returned over" from being run in the future, as a precaution. Here's a link if interested:
 http://lists.squeakfoundation.org/pipermail/squeak-dev/2023-February/223500.html<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As for the idea to reverse the exceptions design back to the original I tried it and it works fine but the current code looks cleaner which might be one of the reasons behind the rewrite. I'll keep thinking about it but will leave this
 for later. So, please don't waste any time with this idea yet :)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Many thanks,<o:p></o:p></p>
<p class="MsoNormal">Best,<o:p></o:p></p>
<p class="MsoNormal">Jaromir<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNoSpacing"><span lang="CS">--</span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;color:#333333;font-weight:normal">Jaromír Matas</span></strong><span style="font-family:"Calibri Light",sans-serif;color:#555555"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="font-family:"Calibri Light",sans-serif;color:#2E75B6">mail@jaromir.net<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:juan@cuis.st">Juan Vuletich</a><br>
<b>Sent: </b>Friday, February 24, 2023 12:01<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:hernan.wilkinson@10pines.com">Hernán Wilkinson</a>; <a href="mailto:mail@jaromir.net">
Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] Code duplication around unwinding<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:black">Hi Jaromir,<br>
<br>
I think this is a good idea, and I agree with the desire to go back to the older Squeak design. However, I don't know why it was made more complicated. It would be good to understand the rationale behind those changes, unless we can be sure that the behavior
 is identical.<br>
<br>
Did you get any relevant feedback from the Squeak list? Maybe someone who is aware of the history of these changes is still available to tell.<br>
<br>
If not, I can spend a little more time and try to do a proper review of the changes myself, although, as you know, this is a bit beyond my comfort zone!<br>
<br>
Thanks!<br>
<br>
On 2/2/2023 3:28 PM, Jaromir Matas via Cuis-dev wrote: <o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:black">Hi Hern</span><span lang="CS" style="color:black">á</span><span style="color:black">n,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thanks for your message!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">> I'll take a look at the code you sent but I prefer for Juan to return to integrate it<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">… of course, there’s no rush, the duplication has been around for 20 years :D<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Most of all, I’m interested in your opinions. As an example, I find this call sequence desperately begging for simplification:
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Exception>>resume: --> resumeUnchecked: --> resumeEvaluating: --> Context>>returnEvaluating: --> resumeEvaluating:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">I mean: in order to resume from an exception you have to traverse four other methods rather than just getting it done in Exception>>resume: as was originally implemented in Squeak 2.8 through 3.5. My aim is to
 get back to this design - unless I’ve missed some fundamental reason why not to. Any feedback *<b>very</b>* welcome.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black">Thanks again,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNoSpacing"><span lang="CS" style="color:black">--</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;font-weight:normal">Jaromír Matas</span></strong><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNoSpacing"><span style="color:black"><a href="mailto:mail@jaromir.net">mail@jaromir.net</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#8FAADC"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:rgb(225,
          225, 225) -moz-use-text-color -moz-use-text-color">
<p class="MsoNormal"><b><span style="color:black">From: </span></b><span style="color:black"><a href="mailto:hernan.wilkinson@10pines.com">Hernán Wilkinson</a><br>
<b>Sent: </b>Thursday, February 2, 2023 19:00<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a><br>
<b>Cc: </b><a href="mailto:juan@cuis.st">juan@cuis.st</a>; <a href="mailto:mail@jaromir.net">
Jaromir Matas</a><br>
<b>Subject: </b>Re: [Cuis-dev] Code duplication around unwinding<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black">Hi Jaromir,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black"> thank you for this proposal!<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> Juan is on vacation, deserved vacations :-) <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> I'll take a look at the code you sent but I prefer for Juan to return to integrate it because he was more involved in the changes you sent.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> About the reason of the duplication of code you see the answer could be really simple: copy & paste!!! :-) <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> I also sometimes spend time trying to understand why the code is duplicated and most of the time it is just that, copy & paste without any intention or knowledge to do it better. I mean, usually it is a human
 reason, not a technical one.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Cheers!<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Hernan.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="color:black">On Thu, Feb 2, 2023 at 1:38 PM Jaromir Matas via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">Hi Juan,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">I'm enclosing a changeset for your review. I've just sent a similar suggestion to Squeak list hoping to get some feedback.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">The aim is to reduce the code duplication in ContextPart>>#restart, #resume:through:, #resumeEvaluating: methods that are implementing the same unwind mechanism we already have in unwindTo:.
 I've always wondered why the same algorithm is duplicated so many times (it used to be in terminate too!) but never really found out.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">At the same time this code duplication was introduced in Squeak 3.6, the unwind mechanism was moved from the Exception class to ContextPart and, but this is just my hypothesis, never cleaned
 up properly.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">I'd be very thankful for your thoughts and your opinion about the enclosed changeset.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">Many thanks,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">Jaromir<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
<p class="m-1962667289679495542msonospacing"><span lang="CS">--</span></p>
<p class="m-1962667289679495542msonospacing"><strong><span style="font-family:"Calibri",sans-serif">Jaromír Matas</span></strong></p>
<p class="m-1962667289679495542msonospacing"><a href="mailto:mail@jaromir.net" target="_blank"><span style="font-family:"Calibri Light \,sans-serif\;"">mail@jaromir.net</span></a></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:#8FAADC"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black"> <o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:1.2in"><span style="color:black">-- <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" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><o:p></o:p></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span style="color:black"><br clear="all">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:black">-- <o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">Hernán Wilkinson</span></strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"><br>
<strong><span style="font-family:"Tahoma",sans-serif;font-weight:normal">Agile Software Development, Teaching & Coaching</span></strong></span><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black;font-weight:normal">Phone: +54-011</span></strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">-4893-2057</span><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black;font-weight:normal">Twitter: @HernanWilkinson</span></strong><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><strong><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black;font-weight:normal">site: </span></strong><span style="color:black"><a href="http://www.10pines.com/" target="_blank"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:#114170">http://www.10Pines.com</span></a><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:"Tahoma",sans-serif;color:black">Address: Alem 896</span><span style="font-size:9.5pt;color:black">, Floor 6, Buenos Aires, Argentina</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:black"><br>
<br>
<o:p></o:p></span></p>
<pre>-- </pre>
<pre>Juan Vuletich</pre>
<pre>cuis.st</pre>
<pre>github.com/jvuletich</pre>
<pre>researchgate.net/profile/Juan-Vuletich</pre>
<pre>independent.academia.edu/JuanVuletich</pre>
<pre>patents.justia.com/inventor/juan-manuel-vuletich</pre>
<pre>linkedin.com/in/juan-vuletich-75611b3</pre>
<pre>twitter.com/JuanVuletich</pre>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>