<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 10, 2016 at 4:57 PM, Tyler Cloutier <span dir="ltr">&lt;<a href="mailto:cloutiertyler@aol.com" target="_blank">cloutiertyler@aol.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On May 10, 2016, at 2:50 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 10, 2016 at 4:46 PM, Tyler Cloutier <span dir="ltr">&lt;<a href="mailto:cloutiertyler@aol.com" target="_blank">cloutiertyler@aol.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On May 10, 2016, at 2:34 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div>I think, on the contrary, it&#39;s missing the point utterly. It&#39;s up to those proposing a new feature to justify its addition in light of what&#39;s already here, and it&#39;s up to those proposing the removal of a feature to justify why it should be removed.<br><br>Certainly no one is proposing the removal of the while loop. Currently, the One Obvious Way of making an infinite loop is `while true`, and it is up to the proponents to advance a reason why a replacement would be superior. I cannot think of a greater non-sequitur than supplying a demonstration of why while loops are useful.<br></div></blockquote><div><br></div></span><div>That’s what I am saying. No one is supplying a demonstration of why while loops are useful and that suggestion is a straw man.</div></div></div></blockquote><div><br></div><div>That was not meant to be a straw man, not on my part. It is my understanding of Harlan&#39;s example. It shows that, without while loops, it is unwieldy to express the same thing using goto statements. That is fine, but it is not at all on point for this discussion.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div> My point below that simple and clear syntax is an improvement on syntax with more noise.</div><div><br></div><div>repeat {</div><div><span style="white-space:pre-wrap">        </span>// code</div><div>}</div><div><br></div><div>vs</div><div><br></div><div>repeat {</div><div><span style="white-space:pre-wrap">        </span>// code</div><div>} while true</div></div></div></blockquote><div><br></div><div>What&#39;s wrong with `while true { }` ? </div></div></div></div></div></blockquote><div><br></div></span><div>This is a good question. In my opinion, nothing in and of itself, however since repeat is part of the language and it has a stand alone meaning in english,</div></div></div></blockquote><div><br></div><div>&quot;Repeat&quot; in English does not mean &quot;do something forever.&quot; It means &quot;do something one more time.&quot;</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div> it stands to reason that users will expect that it can stand alone just as do { } does. I would love to hear if this is a sentiment I alone have, or if others feel the same.</div><div><div class="h5"><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>The reason that the former is superior to the latter is that, given repeat is already part of the language, the former it is simpler, with less noise. It reads like simple english. It also aligns well with current do {} syntax. This is the only argument I’m offering, and I think it’s the only one that could be offered for such a small syntax change given that it *only* serves to clarify and reduce noise of current syntax which has the same functionality.</div><div><div><div><br></div><br><blockquote type="cite"><div><div class="gmail_quote"><div dir="ltr">On Tue, May 10, 2016 at 16:27 Tyler Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On May 10, 2016, at 2:13 PM, Harlan Haskins via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div style="margin:0px;font-size:11px;line-height:normal"><span>You could always do your control flow with goto’s anyway…</span></div><div style="margin:0px;font-size:11px;line-height:normal"><span><br></span></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>func</span><span> foo() {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>  </span><span>var</span><span> i = </span><span>0</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>  </span><span>func</span><span> goto(</span><span>_</span><span> label: </span><span>String</span><span> = </span><span>&quot;entry&quot;</span><span>) {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>switch</span><span> label {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>case</span><span> </span><span>&quot;entry&quot;</span><span>:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>print</span><span>(</span><span>&quot;beginning loop…&quot;</span><span>)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>goto</span><span>(</span><span>&quot;cond&quot;</span><span>)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>case</span><span> </span><span>&quot;cond&quot;</span><span>:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>goto</span><span>(i &lt; </span><span>10</span><span> ? </span><span>&quot;body&quot;</span><span> : </span><span>&quot;end&quot;</span><span>)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>case</span><span> </span><span>&quot;body&quot;</span><span>:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      i += </span><span>1</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>print</span><span>(</span><span>&quot;</span><span>\</span><span>(</span><span>i</span><span>)&quot;</span><span>)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>goto</span><span>(</span><span>&quot;cond&quot;</span><span>)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>case</span><span> </span><span>&quot;end&quot;</span><span>:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>      </span><span>break</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>    </span><span>default</span><span>: </span><span>break</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><span><font face="Menlo">    }</font></span></div><div style="margin:0px;font-size:11px;line-height:normal"><span><font face="Menlo">  }</font></span></div><div style="margin:0px;font-size:11px;line-height:normal"><font face="Menlo"><span>  </span><span>goto</span><span>()</span></font></div><div style="margin:0px;font-size:11px;line-height:normal"><span><font face="Menlo">}</font></span></div><div style="margin:0px;font-size:11px;line-height:normal;min-height:13px"><font face="Menlo"><span></span><br></font></div><div style="margin:0px;font-size:11px;line-height:normal">Apologies,</div><div style="margin:0px;font-size:11px;line-height:normal">Harlan</div></div></div></blockquote><div><br></div><div><br></div></div></div><div style="word-wrap:break-word"><div><div>And isn’t this the point really. Yes there are many different ways of doing something, but there should be one obvious way. IMHO, there is nothing more obvious than just </div><div><br></div><div>repeat {</div><div><br></div><div>}</div><div><br></div><div>It’s very clear. It’s not about adding complex control flow, it’s about simplifying current syntax. I don’t think anyone is arguing that it’s more powerful than what while loops currently offer.</div></div></div><div style="word-wrap:break-word"><div><div><br></div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div style="margin:0px;font-size:11px;line-height:normal"><br></div><div><blockquote type="cite"><div>On May 10, 2016, at 2:05 PM, Taras Zakharko via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div>When I need a loop with complex control flow that does not fit into the classical while {} or repeat {} while structure, I use this:<br><br>do_stuff: do {<br>  …<br>  continue do_stuff<br>} <br><br>This pattern explicit and allows very complex control flow patterns without the drawbacks of the unrestricted goto construct. <br><br>Therefore I don’t see utility with having a repeat {} without while clause. <br><br>Best, <br><br> Taras<br><br><br><blockquote type="cite">On 10 May 2016, at 22:39, Dominik Pich via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br><br><blockquote type="cite"><blockquote type="cite">On May 10, 2016, at 3:30 PM, Tyler Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br>Secondly it’s a very simple way of introducing new programmers to loops. It’s IMHO more clear to a new programmer that repeat will just repeat indefinitely vs while true.<br></blockquote><br>This point seems strange to me - why teach a new programmer about loops by first showing them a looping construct they should probably never use in actual practice until they really know what they’re doing?<br></blockquote>totally agree… it would be a bad first introduction, id say :)<br><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></blockquote><br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></div></blockquote></div><br></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div></div>