<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">
                                        
                                        
                                            
                                        
                                        
                                        Hi all!<div><br></div><div>Yes, #doWhileTrue: does not improve readability compared to #whileTrue and #whileTrue:. Either way, you have to understand that the last statement in a block is its returned value.</div><div><br></div><div>I personally don't like it because "do" kind of means enumerating a collection. :-) And do-it! Ha! ;-)</div><div><br></div><div>Let's follow that thought ... so, #doWhileTrue: becomes #do:whileTrue:</div><div><br></div><div>#(1 2 3 4) do: [:ea | Transcript showln: ea] whileTrue: [:ea | ea < 3].</div><div><br></div><div>That is already possible with #select:, #reject:, or maybe #detect::</div><div><br></div><div>#(1 2 3 4) select: [:ea | ea < 3] thenDo: [:ea | Transcript showln: ea].</div><div><span style="font-size: 13.3333px">(#(1 2 3 4) select: [:ea | ea < 3]) do: [:ea | Transcript showln: ea].</span><br></div><div><span style="font-size: 13.3333px">#(1 2 3 4) detect: [:ea | Transcript showln: ea. ea >= 3] ifNone: [].</span><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">... Funny. And out of topic here. :-) There is no need for #doWhileTrue:. We should deprecate it.</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,</span></div><div><span style="font-size: 13.3333px">Marcel</span></div><div class="mb_sig"></div>
                                        
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 01.04.2020 02:27:11 schrieb Eliot Miranda <eliot.miranda@gmail.com>:</p><div style="font-family:Arial,Helvetica,sans-serif">
<div dir="ltr"><div dir="ltr">Hi Christoph,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 30, 2020 at 10:58 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;min-width: 500px">




<div dir="ltr">
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" style="font-size: 12pt;color: rgb(0,0,0);font-family: Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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>Hi Nicolas,</p>
<p><br>
</p>
<p>> <span style="font-size: 12pt">There is no other sender of doWhileFalse: doWhileTrue: and my advice would be to deprecate them. YAGNI.</span></p>
<div><br>
</div>
<div>So my image actually contains around two dozen senders of #doWhileTrue: and #doWhileFalse: (Squot, Pheno and some of my own code). As mentioned somewhere else in the past, I actually like them and find them very useful.</div>
<div><br>
</div>
<div>In my opinion, many senders of #whileTrue and #whileFalse should be refactored to use #doWhileTrue:/#doWhileFalse:. Here is a random example:</div>
<div><br>
</div>
<div>[newPlace := self getNewPlace.</div>
<div>
<div>dir := ServerFile new fullPath: newPlace.</div>
<div>(dir includesKey: dir fileName)] whileTrue.</div>
<div><br>
</div>
<div>I find that's ugly and counter-intuitive! I would rewrite this in the following way:</div>
<br>
</div>
<div>
<div style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">
[newPlace := self getNewPlace.</div>
<div style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">
<div>dir := ServerFile new fullPath: newPlace]</div>
<div>    doWhileTrue: [dir includesKey: dir fileName].</div></div></div></div></div></div></blockquote><div><br></div><div>Ugh, horrible.  The whileTrue is Smalltalk.  doWhilerye: is some kind of attempt to do C.  I have to say that I *hate* diWhileTrue:.  whileTrue is beautifully elegant.  You'll find it natural if you try and leave behind the damage from more conventional control-flow ischemes.</div><div><br></div><div> </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;min-width: 500px"><div dir="ltr"><div id="gmail-m_3876538975185878370divtagdefaultwrapper" style="font-size: 12pt;color: rgb(0,0,0);font-family: Calibri,Helvetica,sans-serif" dir="ltr"><div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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"><div><div style="font-family: Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols;font-size: 16px">
</div>
<br>
</div>
<p>
</p><div id="gmail-m_3876538975185878370Signature">
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" dir="ltr" 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">
<div name="divtagdefaultwrapper">
<div><span style="font-size: 10pt;color: #808080"></span></div>
</div>
</div>
</div>
The latter just reads easier. blockReturns in multi-statement blocks are not really intuitive.</div>
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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">
In the first version, when scanning the method quickly, I read "okay, something with places and directories is done, while true ...," I wonder "what has to be true?" and have to look back to the end of the block and find the beginning of the last statement.</div>
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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">
But in the second version, I read "okay, something with places and directories is done, while that directory matches this specific condition." This version directly draws my attention to the important condition.</div>
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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">
<br>
</div>
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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">
Happy to hear your counterarguments :-)</div></div></div></blockquote><div><br></div><div>Two blocks where one will do?  Unnecessary.  Blocks are objects and understand messages, so whileTrue is coherent with the rest of the system, more concise, and indeed to my eyes much more elegant.</div><div> </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;min-width: 500px"><div dir="ltr"><div id="gmail-m_3876538975185878370divtagdefaultwrapper" style="font-size: 12pt;color: rgb(0,0,0);font-family: Calibri,Helvetica,sans-serif" dir="ltr">
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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">
<br>
</div>
<div id="gmail-m_3876538975185878370divtagdefaultwrapper" 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_3876538975185878370divtagdefaultwrapper" 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_3876538975185878370x_divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif;color: #000000"><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> Montag, 30. März 2020 12:51 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: System-nice.1149.mcz</span>
<div> </div>
</div>
</div>
<span style="font-size: 10pt"><span style="font-size: 10pt">
<div>Nicolas Cellier uploaded a new version of System to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/System-nice.1149.mcz" id="gmail-m_3876538975185878370LPlnk967140" target="_blank">http://source.squeak.org/trunk/System-nice.1149.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: System-nice.1149<br>
Author: nice<br>
Time: 30 March 2020, 12:50:26.196366 pm<br>
UUID: ece53b0b-24d2-4d4b-bc91-6794a661f886<br>
Ancestors: System-ul.1148<br>
<br>
avoid neuron storming [...] doWhileTrue: true, it just means [...] repeat<br>
<br>
There is no other sender of doWhileFalse: doWhileTrue: and my advice would be to deprecate them. YAGNI.<br>
<br>
=============== Diff against System-ul.1148 ===============<br>
<br>
Item was changed:<br>
  ----- Method: MOFile>>searchByHash: (in category 'experimental') -----<br>
  searchByHash: aString<br>
         | hashValue nstr index incr key |<br>
         hashValue :=  self hashPjw: aString.<br>
         incr := 1 + (hashValue \\ (hashTableSize -2)).<br>
         index := (hashValue \\ hashTableSize) .<br>
         [        nstr := (hashTable at: index +1 ).<br>
                 nstr = 0 ifTrue: [^nil].<br>
                 key := self originalString: nstr.<br>
                 key = aString ifTrue: [^self translatedString: nstr].<br>
                 index >= (hashTableSize - incr) <br>
                                 ifTrue: [index := index - (hashTableSize - incr)  ]<br>
                                 ifFalse:[index := index + incr].        <br>
+        ] repeat!<br>
-        ] doWhileTrue: true.!<br>
<br>
<br>
</div>
</span></span></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: 10pt;border-collapse: separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
</div></blockquote></div>