[swift-evolution] Change `repeat` to loop indefinitely if no while clause is present
Tyler Cloutier
cloutiertyler at aol.com
Tue May 10 15:32:24 CDT 2016
> On May 10, 2016, at 1:10 PM, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
>
> Agreed. I'm not convinced that this actually prevents any more errors than it might cause (forgot to finish writing my "repeat" block, and now my app is unresponsive), and I don't think there's enough of an expressivity win to add another keyword.
Certainly it’s not adding a new keyword, however it is changing the meaning of a keyword.
>
> Austin
>
> On Tue, May 10, 2016 at 1:04 PM, Haravikk via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
>> On 10 May 2016, at 08:27, Nicholas Maccharoli via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> But I think it might be best to change the syntax / behaviour of `repeat` to loop
>> indefinitely if no trailing while clause is present:
>>
>> repeat {
>> if ... { break }
>> //...
>> }
>
> -1 from me on both counts; the thing I like about while true is that it’s explicit about what I meant, whereas a repeat block with no while clause is indistinguishable from me forgetting to include one, or me wanting an infinite loop.
>
> An alternative could be to add a new “forever” keyword or something similar, replacing while true wherever applicable, but personally I don’t think it’s that important.
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160510/f5a01d69/attachment.html>
More information about the swift-evolution
mailing list