<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I think it would be consistent to make it answer the value of the
evaluation of the receiver. Doesn't seem important, though.<br>
<br>
Thanks,<br>
<br>
On 2/27/2023 10:04 AM, Jaromir Matas via Cuis-dev wrote:
<blockquote
cite="mid:PH7PR12MB7987254756571D391904B43DEEAF9@PH7PR12MB7987.namprd12.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;
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="border-right: medium none; border-width: 1pt medium
medium; border-style: solid none none; border-color: rgb(225,
225, 225) -moz-use-text-color -moz-use-text-color; padding:
3pt 0in 0in;">
<p class="MsoNormal" style="border: medium none; padding:
0in;"><b>From: </b><a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:cuis-dev@lists.cuis.st">Discussion of Cuis
Smalltalk</a>;
<a moz-do-not-send="true"
href="mailto:martin@hand2mouse.com">Martin McClure</a><br>
<b>Cc: </b><a moz-do-not-send="true"
href="mailto:juan@cuis.st">juan@cuis.st</a>; <a
moz-do-not-send="true" 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
moz-do-not-send="true" 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
moz-do-not-send="true"
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 style="" lang="EN-US">
<div class="m_6863252944530188061WordSection1">
<p class="MsoNormal">Hi Juan, all,</p>
<p class="MsoNormal"> </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"> </p>
<p class="MsoNormal">[1] valueEnsured</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Enclosed is a suggestion how to
make it return 1.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Best,</p>
<p class="MsoNormal">Jaromir</p>
<p class="MsoNormal"> </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);"></span></p>
<p class="m_6863252944530188061MsoNoSpacing"><span
style="font-family: "Calibri
Light",sans-serif; color: rgb(46, 117, 182);"><a
moz-do-not-send="true"
href="mailto:mail@jaromir.net" target="_blank">mail@jaromir.net</a></span></p>
<p class="MsoNormal"><span style="color: rgb(143, 170,
220);"> </span></p>
<p class="MsoNormal"> </p>
</div>
</div>
-- <br>
Cuis-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a moz-do-not-send="true"
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
size="2" face="tahoma, sans-serif">-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
moz-do-not-send="true"
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>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>