<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 10, 2016, at 2:34 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">I think, on the contrary, it's missing the point utterly. It's up to those proposing a new feature to justify its addition in light of what's already here, and it's up to those proposing the removal of a feature to justify why it should be removed.<br class=""><br class="">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 class=""></div></blockquote><div><br class=""></div><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. My point below that simple and clear syntax is an improvement on syntax with more noise.</div><div><br class=""></div><div>repeat {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// code</div><div>}</div><div><br class=""></div><div>vs</div><div><br class=""></div><div>repeat {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>// code</div><div>} while true</div><div><br class=""></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><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, May 10, 2016 at 16:27 Tyler Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></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" class=""><div class=""><blockquote type="cite" class=""><div class="">On May 10, 2016, at 2:13 PM, Harlan Haskins via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div style="margin:0px;font-size:11px;line-height:normal" class=""><span class="">You could always do your control flow with goto’s anyway…</span></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><span class=""><br class=""></span></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">func</span><span class=""> foo() {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; </span><span class="">var</span><span class=""> i = </span><span class="">0</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; </span><span class="">func</span><span class=""> goto(</span><span class="">_</span><span class=""> label: </span><span class="">String</span><span class=""> = </span><span class="">"entry"</span><span class="">) {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">switch</span><span class=""> label {</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">case</span><span class=""> </span><span class="">"entry"</span><span class="">:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">print</span><span class="">(</span><span class="">"beginning loop…"</span><span class="">)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">goto</span><span class="">(</span><span class="">"cond"</span><span class="">)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">case</span><span class=""> </span><span class="">"cond"</span><span class="">:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">goto</span><span class="">(i &lt; </span><span class="">10</span><span class=""> ? </span><span class="">"body"</span><span class=""> : </span><span class="">"end"</span><span class="">)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">case</span><span class=""> </span><span class="">"body"</span><span class="">:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; i += </span><span class="">1</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">print</span><span class="">(</span><span class="">"</span><span class="">\</span><span class="">(</span><span class="">i</span><span class="">)"</span><span class="">)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">goto</span><span class="">(</span><span class="">"cond"</span><span class="">)</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">case</span><span class=""> </span><span class="">"end"</span><span class="">:</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; &nbsp; </span><span class="">break</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; &nbsp; </span><span class="">default</span><span class="">: </span><span class="">break</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><span class=""><font face="Menlo" class="">&nbsp; &nbsp; }</font></span></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><span class=""><font face="Menlo" class="">&nbsp; }</font></span></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><font face="Menlo" class=""><span class="">&nbsp; </span><span class="">goto</span><span class="">()</span></font></div><div style="margin:0px;font-size:11px;line-height:normal" class=""><span class=""><font face="Menlo" class="">}</font></span></div><div style="margin:0px;font-size:11px;line-height:normal;min-height:13px" class=""><font face="Menlo" class=""><span class=""></span><br class=""></font></div><div style="margin:0px;font-size:11px;line-height:normal" class="">Apologies,</div><div style="margin:0px;font-size:11px;line-height:normal" class="">Harlan</div></div></div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class="">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&nbsp;</div><div class=""><br class=""></div><div class="">repeat {</div><div class=""><br class=""></div><div class="">}</div><div class=""><br class=""></div><div class="">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" class=""><div class=""><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word" class=""><div style="margin:0px;font-size:11px;line-height:normal" class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On May 10, 2016, at 2:05 PM, Taras Zakharko via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div class="">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 class=""><br class="">do_stuff: do {<br class=""> &nbsp;…<br class=""> &nbsp;continue do_stuff<br class="">} <br class=""><br class="">This pattern explicit and allows very complex control flow patterns without the drawbacks of the unrestricted goto construct. <br class=""><br class="">Therefore I don’t see utility with having a repeat {} without while clause. <br class=""><br class="">Best, <br class=""><br class=""> Taras<br class=""><br class=""><br class=""><blockquote type="cite" class="">On 10 May 2016, at 22:39, Dominik Pich via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On May 10, 2016, at 3:30 PM, Tyler Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">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 class=""></blockquote><br class="">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 class=""></blockquote>totally agree… it would be a bad first introduction, id say :)<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div></div>_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>