[swift-evolution] Remove forEach?

Joe Groff jgroff at apple.com
Tue Dec 8 16:13:05 CST 2015


> On Dec 8, 2015, at 1:58 PM, Chris Eidhof via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I think having a different syntax for returning from an anonymous function would be a bad idea. They’re really the same thing.

Another direction you might take this is to make it a type annotation on the function type, like throws, so forEach has a type like this:

func forEach(body: (Element) breaks -> ())

and a closure that `breaks` has nonlocal behavior for break/continue/return (and is implied to be noescape and void-returning, I guess).

-Joe


More information about the swift-evolution mailing list