<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Oh you are right, I totally missed that, thanks.</div><div><br>On May 10, 2016, at 12:10 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div style="white-space:pre-wrap">Nicholas wrote that he would like `while true` to be a compile-time error. I'm curious as to why.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 10, 2016 at 13:47 Tyler Cloutier &lt;<a href="mailto:cloutiertyler@aol.com">cloutiertyler@aol.com</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 12:39 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><div class="gmail_extra"><div class="gmail_quote">On Tue, May 10, 2016 at 2:27 AM, Nicholas Maccharoli via swift-evolution<span>&nbsp;</span><span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span><span>&nbsp;</span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">​Swift Evolution ​Community,</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">Currently writing an infinite loop in swift looks either something like this:</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>while true {</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>if ... { break }</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>//...</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>}</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">Or this:</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>repeat {</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>if ... { break }</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>//...</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>} while true</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">But I think it might be best to change the syntax / behaviour of `repeat` to loop&nbsp;</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">indefinitely if no trailing while clause is present:</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>repeat {</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>if ... { break }</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>//...</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>}</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">while still allowing a trailing `while` clause as in:</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>repeat {&nbsp;</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp; &nbsp; &nbsp;<span>&nbsp;</span>foo += bar</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">&nbsp; &nbsp;<span>&nbsp;</span>} while foo.count &lt; limit&nbsp;</div></div></blockquote><div>&nbsp;</div><div>What is your motivation for this change?</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">I also want to propose that it should be a compile time error to use single `Bool` constants as while loop conditions, so no more `while true { ... }` it would become `repeat { ... }`</div></div></blockquote><div><br></div><div>What problems are solved by forbidding `while true`?</div></div></div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>I don’t think the proposal is forbidding it, but rather making it optional. So that&nbsp;</div><div><br></div><div>repeat {</div><div><br></div><div>}&nbsp;</div><div><br></div><div>is equivalent to&nbsp;</div><div><br></div><div>repeat {</div><div><br></div><div>} while true</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><div class="gmail_extra"><div class="gmail_quote"><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">I was thinking of drafting a short proposal if there was enough positive feedback.&nbsp;<br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">How does it sound?</div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br></div><div style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">- Nick&nbsp;</div></div><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" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br></blockquote></div><br></div></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></div></blockquote></div>
</div></blockquote></body></html>