<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Jaromir,<br>
<br>
On 6/5/2021 10:04 AM, Jaromir Matas via Cuis-dev wrote:
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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;}
/* 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;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";
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>
<div class="WordSection1">
<p class="MsoNormal">Hi Juan,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> Hi Jaromir,</p>
<p class="MsoNormal">><o:p> </o:p></p>
<p class="MsoNormal">> I've just pushed your latest to
GitHub. I included a note with links to this email thread in
#terminate. I also added the new tests; and your examples as a
class method in Process, for future reference.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You made my day, thanks :) It's been a
great learning experience; I'd like to thank you for your
valuable comments and feedback that helped me to stay on
track. Also, I appreciate you keep Cuis' kernel simple and
compact.</p>
</div>
</blockquote>
<br>
My pleasure!<br>
<br>
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><o:p> <br>
</o:p></p>
<p class="MsoNormal">I'd like to share some remarks:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">1) you might ask why #complete:to: is
defined in Process and not in ContextPart? It should, really,
but I wanted to keep it the same as in Squeak for the moment
:)</p>
</div>
</blockquote>
<o:p> </o:p>
<o:p><br>
Using the same code as Squeak is a good idea for areas in the
system where we don't chose a different approach!<br>
<br>
</o:p>
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal">2) there's currently a discussion
(Christoph) what semantics is the most appropriate for closing
the debugger: If you encounter a fatal error or the debugged
process is damaged too badly, using #terminate might be "too
strong" and lead e.g. to an infinite recursion of debuggers
etc. For such cases a "light" version od #terminate
(#terminateLight) without completing the halfway through
unwind contexts would probably be more appropriate. For the
most severe cases even a Kill option without any unwinds might
come in handy. I imagine e.g. using #terminate for the
standard closing of the debugger's window and the light
version of #terminate for an explicit Abandon button.
</p>
</div>
</blockquote>
<br>
I think that [Abandon] should also do #terminate. And a new button
[Kill] is preferable. (Maybe use the same button, but with [Shift],
or a right-click menu, etc) Please don't call it "light" as it is
actually stronger, because it does "more violence" to the process
(meaning that the use of 'light' or 'strong' won't be obvious, and
will have to be explained every time!). It is best to stick to
standard nomenclature. Terminate (SIGTERM) as the default, usually
safe way, and Kill (SIGKILL) as the last resort. These are the names
used in Linux / Unix.<br>
<br>
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">3) I'd like to raise a question about
non-local return's semantics during termination:
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> **What takes precedence: a
termination or a non-local return?**</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Squeak has a method `valueUninterruptably
^ self ifCurtailed: [^ self]` which in its comment says: "Even
attempts to terminate (unwind) this process will be halted and
the process will resume here. A terminate message is needed
for every one of these in the sender chain to get the entire
process unwound."</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It means Squeak authors originally intended
to allow a process to escape its termination via a non-local
return inside an unwind block but the implementation never
worked.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The alternative behavior is: termination
takes precedence and doesn't allow a non-local return to route
the computation outside the unwind block. This is the behavior
of the current #terminate.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I'd like to know your opinion about this
matter; the new #terminate can be amended easily to allow for
non-local returns take precedence over termination but I'm not
sure it's really desirable - what do you think?</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Example:</p>
<p class="MsoNormal">```</p>
<p class="MsoNormal">p := [</p>
<p class="MsoNormal"> [:exit | [Processor
activeProcess suspend] "<-- terminate here"</p>
<p class="MsoNormal"> ensure: [exit
value]] valueWithExit.</p>
<p class="MsoNormal"> Transcript show: 'escaped
termination'</p>
<p class="MsoNormal">] newProcess resume.</p>
<p class="MsoNormal">Processor yield.</p>
<p class="MsoNormal">[p terminate] fork</p>
<p class="MsoNormal">```</p>
<p class="MsoNormal">Current implementation will not print
anything and just terminate the process p because there are no
unwind blocks except `[exit value]`.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Originally, however, the non-local return
inside `[exit value]` was intended for the process p to escape
termination and continue executing, i.e. print 'escaped
termination' and go on.</p>
</div>
</blockquote>
<o:p></o:p>
<o:p><br>
I have no opinion. So, I wouldn't change it unless a compelling
argument appears.<br>
<br>
</o:p>
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal">4) One last comment FYI: #unwindTo: method
under ContextPart in my opinion suffers with the same bug as
#terminate used to, and could be fixed similarly (there are
currently no senders however). Check this example:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">```</p>
<p class="MsoNormal">p := [</p>
<p class="MsoNormal"> [:exit |
[Processor activeProcess suspend] "<-- unwind here"</p>
<p class="MsoNormal">
ensure: [exit value]] valueWithExit</p>
<p class="MsoNormal"> ] newProcess resume.</p>
<p class="MsoNormal">Processor yield.</p>
<p class="MsoNormal">p suspendedContext unwindTo: nil</p>
<p class="MsoNormal">```</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It incorrectly produces the
BlockCannotReturn error. If you do `p terminate` instead of `p
suspendedContext unwindTo: nil`, it works as expected.</p>
</div>
</blockquote>
<br>
I guess a comment stating exactly what you say is enough, at least
unless there is areal need for #unwindTo: If you are willing to
write it, I'll be happy to integrate it.<br>
<br>
<blockquote
cite="mid:BN7PR08MB384285A80F464E2B2CAFE41DEE3A9@BN7PR08MB3842.namprd08.prod.outlook.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal">Thanks again.</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>
</div>
</blockquote>
<br>
Thank you!<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
</body>
</html>