But if the closure can escape it is difficult to guarantee that it is executed at all (e.g. in your examples such as dispatch_async).
Am 29. Januar 2016 um 11:58 schrieb Brent Royal-Gordon via swift-evolution email@example.com:
You are right Jacob, a modifier
@noescape(once)would be better, as it would help compiler distinguish between assignment and initialization of captured variables.
The utility of such a new feature is maybe tiny, but clear: it extends the opportunities to declare variables before initializing them. The Swift 1 to 2 transition has already extended those opportunities, so we’re just following an existing trend, here.
I actually think that
onceis orthogonal to
noescape. There are a lot of closures that are not noescape, but are called exactly once, such as dispatch_async and most completion handlers.
swift-evolution mailing list