<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<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;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.m6863252944530188061msonospacing, li.m6863252944530188061msonospacing, div.m6863252944530188061msonospacing
{mso-style-name:m_6863252944530188061msonospacing;
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;}
.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"><span lang="CS">Hi Hern</span>an,</p>
<p class="MsoNormal">Thanks for your msg. I’m AFK so briefly: At least one critical use of valueEnsured (or [] ensure: aBlock) is in #terminate. We need to make sure the receiver is evaluated even if the process is terminated. Replacing it with #value will
show you which test will fail :)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Yes, it may be understood as a mere shortcut as you wrote but I’m thinking it may as well get another semantics, which is: Evaluate the receiver no matter what and return the block’s return value. In terminate I don’t need the return value
but in general it may make sense.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Any opinions welcome; although I’m aware this has rather rare use :)</p>
<p class="MsoNormal">Thanks again,</p>
<p class="MsoNormal">Jaromir</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:hernan.wilkinson@10pines.com">Hernán Wilkinson</a><br>
<b>Sent: </b>Monday, February 27, 2023 13:18<br>
<b>To: </b><a href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis Smalltalk</a>;
<a href="mailto:martin@hand2mouse.com">Martin McClure</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] #valueEnsured return value</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div dir="ltr">hmmm I'm not sure it is a good idea because it goes against the expected return value of #ensure:<br>
<div>I mean, #valueEnsured is just a shortcut for [] ensure: [...], and #ensure: returns the return value of evaluating the receiver block, not the parameter block. The receiver block is [] so it should return nil ([] value).</div>
<div>Currently it is not returning nil because it is implemented like this:</div>
<div>[] ensure: self<br>
</div>
<div>and it should be:</div>
<div>^[] ensure: self</div>
<div><br>
</div>
<div>Now I'm thinking... I do not understand the need for #valueEnsured, why not just send #value to the block? What is the difference?</div>
<div>I see that #ensure: sends the message #valueNoContextSwitch instead of #value, why not sending #valueNoContextSwitch instead of #valueEnsured then?</div>
<div>I see that #valueEnsured was suggested by <a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:martin@hand2mouse.com" tabindex="-1">@Martin McClure</a> , Martin, could you explain the need for this message? Thank you!!</div>
<div><br>
</div>
<div>And now, because I'm inconsistent (that is, human :-) ), I'm not sure #valueEnsured has to keep the semantics of the return value of #ensure:, it could not if there is a need for what you are suggesting.</div>
<div>Anyway, I'd like to understand why #valueEnsured is needed.</div>
<div><br>
</div>
<div>Cheers!</div>
<div>Hernan.</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Feb 26, 2023 at 8:34 AM Jaromir Matas 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">
<div class="msg3878518906851524794">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_6863252944530188061WordSection1">
<p class="MsoNormal">Hi Juan, all,</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’d expect this example return 1 instead of a block (for general usage); what do you think?</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">[1] valueEnsured</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Enclosed is a suggestion how to make it return 1.</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best,</p>
<p class="MsoNormal">Jaromir</p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="m_6863252944530188061MsoNoSpacing"><span lang="CS">--</span></p>
<p class="m_6863252944530188061MsoNoSpacing"><strong><span style="font-family:"Calibri Light",sans-serif;color:rgb(51,51,51);font-weight:normal">Jaromír Matas</span></strong><span style="font-family:"Calibri Light",sans-serif;color:rgb(85,85,85)"><u></u><u></u></span></p>
<p class="m_6863252944530188061MsoNoSpacing"><span style="font-family:"Calibri Light",sans-serif;color:rgb(46,117,182)"><a href="mailto:mail@jaromir.net" target="_blank">mail@jaromir.net</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:rgb(143,170,220)"><u></u> <u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
-- <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>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div style="font-size:small">
<div dir="ltr">
<div dir="ltr">
<div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><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></strong></span></div>
<div style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><span style="font-size:small"><font size="2"><span style="font-weight:normal">Phone: +54-011</span></font></span></span></strong></span><font face="tahoma, sans-serif" size="2">-4893-2057</font></div>
<div style="font-size:12.8px"><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 style="font-size:12.8px"><span style="font-family:tahoma,sans-serif;font-size:xx-small;border-collapse:collapse"><strong><span style="font-size:8pt"><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></strong></span></div>
<div style="font-size:12.8px"><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>
</body>
</html>