<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=""><div class="">I do not see sufficiently measurable benefits to this proposal to add it to the language. </div><div class="">It's easy enough to roll your own `repeatForever` function with trailing closure.</div><div class=""><br class=""></div><div class="">I also want to thank you for bring it up on-list. Not every idea is right for Swift but it's</div><div class="">always refreshing to see innovative thoughts added to the discussion. Please do not be </div><div class="">discouraged by the generally negative feedback on this particular idea.</div><div class=""><br class=""></div><div class="">-- Erica</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On May 10, 2016, at 1:27 AM, Nicholas Maccharoli via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">Swift Evolution Community,</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" 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 class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> while true {</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> if ... { break }</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> //...</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> }</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">Or this:</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> repeat {</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> if ... { break }</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> //...</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> } while true</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" 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 </div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">indefinitely if no trailing while clause is present:</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> repeat {</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> if ... { break }</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> //...</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> }</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">while still allowing a trailing `while` clause as in:</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> repeat { </div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> foo += bar</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"> } while foo.count < limit </div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" 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 class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" 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. </div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">How does it sound?</div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)"><br class=""></div><div class="gmail_default" style="font-family:'comic sans ms',sans-serif;color:rgb(39,78,19)">- Nick </div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>