[swift-evolution] Remove forEach?

Joe Groff jgroff at apple.com
Wed Dec 9 13:08:00 CST 2015


> On Dec 9, 2015, at 10:23 AM, Guillaume Lessard via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On 9 déc. 2015, at 10:01, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> A language construct that helps eliminate multiple other language constructs would potentially be a net win, though. If there were closures that supported nonlocal exits, then `do`, `for...in`, and possibly other constructs could become library functions, and other "block-like" library features like `autoreleasepool`, `withUnsafePointer` would work more naturally too.
> 
> If a `for` loop became a library function with special closures, what would happen to labeled break statements?
> 
> e.g.
> outer: for i in 0..<5 {
>  for j in 0..<5 {
>    break outer
>  }
> }

Seems to me that's still supportable; it's not much different from catching specific error types. It's one of many things someone proposing this would need to account for.

-Joe


More information about the swift-evolution mailing list