[swift-users] Compiler refuses non-escaping closure calls in nested function

Ole Begemann ole at oleb.net
Tue Oct 11 10:38:17 CDT 2016

> So I suppose you feel this case is different from the (unsafe) implicitly unwrapping of optionals with the “!” operator.
> Why do you feel the situation is different?

I agree that it's a somewhat similar situation, at least if the function 
declaration were made explicit with a `@nonescaping` keyword as you 

I just think features like force-unwrapping of optionals should remain 
the exception, not the rule. Just because most people will agree (I 
assume) that force-unwrapping is useful, doesn't automatically mean we 
should extend this logic to other use cases.

On a side note, part of SE-0103 [1] was the 
`withoutActuallyEscapingFunction` function, which would actually allow 
you to explicitly override the compiler, though I'm not sure it would 
cover the nested function situation we're discussing here. Sadly, 
`withoutActuallyEscapingFunction` is implemented yet [2].

[2]: https://bugs.swift.org/browse/SR-2313

More information about the swift-users mailing list