<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" 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>
<br>
</div>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" 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" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
The latter just reads easier. blockReturns in multi-statement blocks are not really intuitive.</div>
<div id="divtagdefaultwrapper" 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="divtagdefaultwrapper" 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="divtagdefaultwrapper" 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="divtagdefaultwrapper" 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 id="divtagdefaultwrapper" 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="divtagdefaultwrapper" 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="divtagdefaultwrapper" 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 tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von commits@source.squeak.org <commits@source.squeak.org><br>
<b>Gesendet:</b> Montag, 30. März 2020 12:51 Uhr<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org; packages@lists.squeakfoundation.org<br>
<b>Betreff:</b> [squeak-dev] The Trunk: System-nice.1149.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">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="LPlnk967140" previewremoved="true">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></font></div>
</div>
</div>
</body>
</html>