<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 12:39 AM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote">On Tue, May 10, 2016 at 2:27 AM, Nicholas Maccharoli via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><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" class=""><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">​Swift Evolution ​Community,</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">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);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>while true {</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ... { break }</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>//...</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">Or this:</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>repeat {</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ... { break }</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>//...</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>} while true</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">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);" class="">indefinitely if no trailing while clause is present:</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>repeat {</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>if ... { break }</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>//...</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">while still allowing a trailing `while` clause as in:</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>repeat {&nbsp;</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>foo += bar</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>} while foo.count &lt; limit&nbsp;</div></div></blockquote><div class="">&nbsp;</div><div class="">What is your motivation for this change?</div><div class="">&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" class=""><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">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 class=""><br class=""></div><div class="">What problems are solved by forbidding `while true`?</div></div></div></div></div></div></blockquote><div><br class=""></div><div>I don’t think the proposal is forbidding it, but rather making it optional. So that&nbsp;</div><div><br class=""></div><div>repeat {</div><div><br class=""></div><div>}&nbsp;</div><div><br class=""></div><div>is equivalent to&nbsp;</div><div><br class=""></div><div>repeat {</div><div><br class=""></div><div>} while true</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">&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" class=""><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">I was thinking of drafting a short proposal if there was enough positive feedback.&nbsp;<br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">How does it sound?</div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class=""><br class=""></div><div style="font-family: 'comic sans ms', sans-serif; color: rgb(39, 78, 19);" class="">- Nick&nbsp;</div></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" 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=""><br class=""></blockquote></div><br class=""></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>