> On May 10, 2016, at 5:56 PM, Chris Lattner <[email protected]> wrote:
> 
> 
>> On May 10, 2016, at 4:13 PM, Cole Campbell via swift-evolution 
>> <[email protected]> wrote:
>> 
>> I agree that repeat { } is ambiguous because you have to look to the end for 
>> a while clause to determine if it's infinite or not.
> 
> Right, this is the downside that I see with “repeat {}”.


Not to beat a dead horse, but isn’t this also true of 

repeat {

} while true

and 

while true {
   ...
   ...
   if condition {
        break
   }
}

> 
>> while true { } is preferable in that regard, but a compromise that I saw 
>> mentioned is:
>> 
>> repeat forever { }
> 
> This would require taking “forever” as a keyword if we supported “repeat N 
> {", something we wouldn’t want to do.
> 
> Another option is to make it a statement modifier, which wouldn’t require 
> taking it as a keyword (but also doesn’t read as well):
> 
> forever repeat { }
> 
> 
> Personally, I don’t see this as a big enough improvement over “while true” to 
> be worth introducing complexity for. 
> 

If you are referring to “forever", I also don’t think that adding a new keyword 
is an improvement over “while true”.

> -Chris

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to