[swift-evolution] Remove forEach?

Guillaume Lessard glessard at tffenterprises.com
Wed Dec 9 12:23:07 CST 2015


> 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
  }
}

Guillaume Lessard



More information about the swift-evolution mailing list