<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 31, 2020 at 2:00 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr">I think this is especially confusing since the comment says that the primitive always fails, and then the expectation is that the Smalltalk code that follows is executed instead. But that code does not do what the method actually does<br></div></blockquote><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I disagree.  It does exactly what the method does (it *is* the implementation of the method) unless the stack is unwound.  Yes, the comment could point the reader to <span style="color:rgb(0,0,0)">Context>>#resume:through: which runs the ensure: & ifCurtailed: blocks on unwind.  Bit otherwise ifCurtailed: is not somehow magically not executed.  It is what it is ;-)</span></font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">As I said earlier, <span style="color:rgb(0,0,0)"> ifCurtailed: only evaluates its argument if a non-local return or exception return is taken and the normal return path is not taken.  See Context>>#resume:through: which runs the ensure: & ifCurtailed: blocks.</span></font></div><div><font face="arial, sans-serif"><span style="color:rgb(0,0,0)"><br></span></font></div><div><font face="arial, sans-serif"><span style="color:rgb(0,0,0)">Can I confirm that your dissatisfaction is with the comment?  Or do you really think the ifCurtailed: method does not execute verbatim in the absence of unwinds?  If the former, you're welcome to submit an improved comment.  If the latter, you're mistaken.</span></font></div><div><span style="color:rgb(0,0,0)"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 31, 2020 at 4:51 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi Eliot,</div><div><br></div><div>Sorry about top-posting previously. Stupid Gmail!<br></div><div><br></div><div>
<div><div><img id="gmail-m_-3246816058428083451gmail-m_-4192212909250988600gmail-:mk_25-e" name="m_-3246816058428083451_m_-4192212909250988600_:mk" src="https://www.google.com/s2/u/0/photos/public/AIbEiAIAAABDCIiYzrz8h92PSyILdmNhcmRfcGhvdG8qKDA3ZWMxY2I1NmI2ZGJjMTBlMDEyOGY4NmJlODM2NzYxY2MxYzY5NTkwAVa50OAEOYpY08k1GfJzyWXGbXpu?sz=40"></div></div><div><div><table cellpadding="0"><tbody><tr><td><table cellpadding="0"><tbody><tr><td><h3><span><span name="Eliot Miranda">Eliot Miranda</span> <span><a href="https://support.google.com/mail/answer/1311182?hl=en" target="_blank">via</a> <a href="http://squeak.org" target="_blank">squeak.org</a> </span></span></h3></td></tr></tbody></table></td><td><div><span></span><span id="gmail-m_-3246816058428083451gmail-m_-4192212909250988600gmail-:vb" title="Aug 31, 2020, 4:40 PM" alt="Aug 31, 2020, 4:40 PM">4:40 PM (4 minutes ago)</span></div></td></tr></tbody></table></div></div><table cellpadding="0"><tbody><tr><td><br></td><td rowspan="2"><br></td></tr></tbody></table><table cellpadding="0"><tbody><tr></tr></tbody></table><table cellpadding="0"><tbody><tr><td colspan="3"><table cellpadding="0"><tbody><tr><td><div><span>to <span dir="ltr" name="Open">Open</span> </span></div><div id="gmail-m_-3246816058428083451gmail-m_-4192212909250988600gmail-:yf"><img src="https://mail.google.com/mail/u/0/images/cleardot.gif" alt=""></div></td></tr></tbody></table></td></tr></tbody></table></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 31, 2020 at 4:40 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Florin,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 31, 2020 at 1:35 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div>Hi Eliot,</div><div><br></div><div>Thank you for your reply and for the extra details about #instVarAt:.</div><div>To answer your question, I would have expected the primitive to fail for non-pointers objects, as I associate in my mind instvars with named instvars, but I am not invested in this (mis)association, so thank you for correcting it.</div><div><br></div><div>But regarding #ifCurtailed, I know that primitives198 1nd 199 are not "real", I was referring to something else. The primitive failure code in the method #ifCurtailed never touches the argument, regardless of the path taken. I think that is incorrect, even if only for documentation purposes.</div></div></blockquote><div><br></div><div>I don't understand.  I see no error code.  We're talking about this method right?</div><div><br></div><div>BlockClosure>>ifCurtailed: aBlock</div><div><span style="white-space:pre-wrap">   </span>"Evaluate the receiver with an abnormal termination action.</div><div><span style="white-space:pre-wrap"> </span> Evaluate aBlock only if execution is unwound during execution</div><div><span style="white-space:pre-wrap">   </span> of the receiver.  If execution of the receiver finishes normally do</div><div><span style="white-space:pre-wrap">    </span> not evaluate aBlock.  N.B.  This method is *not* implemented as a</div><div><span style="white-space:pre-wrap">     </span> primitive.  Primitive 198 always fails.  The VM uses prim 198 in a</div><div><span style="white-space:pre-wrap">    </span> context's method as the mark for an ensure:/ifCurtailed: activation."</div><div><span style="white-space:pre-wrap">  </span>| complete result |</div><div><span style="white-space:pre-wrap">      </span><primitive: 198></div><div><span style="white-space:pre-wrap">   </span>result := self valueNoContextSwitch.</div><div><span style="white-space:pre-wrap">     </span>complete := true.</div><div><span style="white-space:pre-wrap">        </span>^result</div><div> </div></div></div></div></blockquote><div><br></div><div><br></div><div><br></div>I did not mention an error code, I was talking about the "primitive failure code", referring to the Smalltalk code that gets invoked when the primitive fails (the three rows after the pragma).</div><div class="gmail_quote">This Smalltalk code does not touch the method's argument (aBlock), so it looks as if aBlock is never evaluated<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Florin<br></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div>