<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Christoph,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 7, 2020 at 6:01 AM Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de">Christoph.Thiede@student.hpi.uni-potsdam.de</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 id="gmail-m_-3884260269848518631divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_-3884260269848518631divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<p>Take this as a memo for myself -- of course, it would be great to hear your ideas about the following points!</p>
<p><br>
</p>
<p>Further steps:</p>
<p><br>
</p>
<p></p>
<ul style="margin-bottom:0px;margin-top:0px">
<li>Implement the same return logic for #while(True|False)[:]. This might also require changes in the Compiler.</li><li>
<div>Inline #whileNil(:) implementation as well.<br>
General question: Is there such a thing as "too much inlining"? Would it be desirable to inline #cull: and others? Where do we draw the line between performance and Smalltalk-essential explorability?</div>
</li><li>
<div><span style="font-size:12pt">Implement all these controlling methods in a way that could work without inlining (though slow). At the moment, #whileTrue: refers to itself.<br>
An approach that completely foregos inline code would either need to use recursion (linear complexity) or "thisContext restart" (constant time complexity).</span></div>
</li><li>Should we maybe find a way to highlight methods that are inlined? For example, by using a pragma <inlined>. Or rather ask Encoder for it than storing this information in the methods.<br>
<span style="font-size:12pt">Should we warn or forbid the user to overri</span><span style="font-size:12pt">d</span><span style="font-size:12pt">e (or even
</span><span style="font-size:12pt">overwrite</span><span style="font-size:12pt">) such methods?</span>
<ul>
<li>Similar concern: It is dangerous to override #class et al., should we warn here, too?</li></ul></li></ul></div></div></div></blockquote><div><br></div><div>BTW, this is a hack, I would argue one that is extremely confusing for the beginner:</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>whileTrue: aBlock </div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>"Ordinarily compiled in-line, and therefore not overridable.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>This is in case the message is sent to other than a literal block.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Evaluate the argument, aBlock, as long as the value of the receiver is true."</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>^ [self value] whileTrue: [aBlock value]</div></div><div><br></div><div>It should read something like</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>whileTrue: aBlock </div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>"Ordinarily compiled in-line, and therefore not overridable, and not recursive.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>This method exists in case the message is sent to other than a literal block.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Evaluate the argument, aBlock, as long as the value of the receiver is true."</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>self value ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>[aBlock value.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> ^self whileTrue: aBlock].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>^nil</div><div><br></div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">or</span></div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>whileTrue: aBlock </div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>"Ordinarily compiled in-line, and therefore not overridable, and not recursive.</div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>This method will be used if the message is sent to other than a literal block.</div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>Evaluate the argument, aBlock, as long as the value of the receiver is true."</div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>self value ifTrue:</div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>[aBlock value.</div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> [self value] whileTrue: aBlock].</div><div style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>^nil</div></div><div style="color:rgb(0,0,0)"><br></div><div>this is what it read in Smalltalk-80 v2:</div><div><br></div><div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>whileTrue: aBlock</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> "Evaluate the argument, aBlock, as long as the value</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> of the receiver is true. Ordinarily compiled in-line.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> But could also be done in Smalltalk as follows"</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> ^self value</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> ifTrue:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> [aBlock value.</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> self whileTrue: aBlock]</div></div><div><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 id="gmail-m_-3884260269848518631divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr"><div id="gmail-m_-3884260269848518631divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
Best,</div>
<div id="gmail-m_-3884260269848518631divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
Christoph<br>
<br>
<div style="color:rgb(0,0,0)">
<div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-3884260269848518631x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <<a href="mailto:squeak-dev-bounces@lists.squeakfoundation.org" target="_blank">squeak-dev-bounces@lists.squeakfoundation.org</a>> im Auftrag von <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>><br>
<b>Gesendet:</b> Dienstag, 3. März 2020 22:38 Uhr<br>
<b>An:</b> <a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>; <a href="mailto:packages@lists.squeakfoundation.org" target="_blank">packages@lists.squeakfoundation.org</a><br>
<b>Betreff:</b> [squeak-dev] The Trunk: Kernel-ct.1295.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div>Nicolas Cellier uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-ct.1295.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-ct.1295.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-ct.1295<br>
Author: ct<br>
Time: 24 January 2020, 5:20:51.814415 pm<br>
UUID: 18ea3b5d-ee42-2944-9d01-aa48e43207a7<br>
Ancestors: Kernel-nice.1292<br>
<br>
Extends BlockClosure >> #whileNil: by returning the final non-nil value. Adds #whileNil analogous to #whileTrue and #whileFalse.<br>
<br>
[Project uiManager chooseFrom: #(foo bar) values: #(Foo Bar)] whileNil.<br>
<br>
[Project uiManager chooseFrom: #(foo bar) values: #(Foo Bar)] whileNil: [self inform: 'You have to decide!']<br>
<br>
=============== Diff against Kernel-nice.1292 ===============<br>
<br>
Item was added:<br>
+ ----- Method: BlockClosure>>whileNil (in category 'controlling') -----<br>
+ whileNil<br>
+ "Unlike #whileTrue/False this is not compiled inline."<br>
+ | result |<br>
+ [(result := self value) isNil] whileTrue.<br>
+ ^ result<br>
+ !<br>
<br>
Item was changed:<br>
----- Method: BlockClosure>>whileNil: (in category 'controlling') -----<br>
whileNil: aBlock <br>
"Unlike #whileTrue/False: this is not compiled inline."<br>
+ | result |<br>
+ [(result := self value) isNil] whileTrue: [aBlock value].<br>
+ ^ result<br>
- ^ [self value isNil] whileTrue: [aBlock value]<br>
!<br>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
<br>
</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></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>