<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="">I’d actually say that I’m strongly in favor of allowing just a repeat keyword, although I wouldn’t support making 'while true’.<div class=""><br class=""></div><div class="">Firstly it reduces clutter and makes it very clear that the the code is just supposed to repeat. </div><div 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.</div><div class="">Lastly, this isn’t the first time this has been brought up on this list and there was previously discussion about the fact that when people see the repeat keyword that it should naturally repeat indefinitely unless a where clause is specified.</div><div class=""><br class=""></div><div class="">I also think the concern that an accidental infinite loop is any greater than it is currently.</div><div class=""><br class=""></div><div class="">Tyler</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 10, 2016, at 1:09 PM, Erica Sadun 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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 class=""><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></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=""></div></div></div></body></html>