@once closure

Hello Lantua. This was the SE-0073 proposal: [Review] SE-0073: Marking closures as executing exactly once

It was rejected: [Rejected] SE-0073: Marking closures as executing exactly once

The main reason for rejection was the implementation challenges:

Separate from the surface level issues, the implementation underlying this work has some significant challenges that are doable but would require major engineering work. Specifically, the definite initialization pass needs to “codegen” booleans in some cases for conditional initialization/overwrite cases, and these state values would have to be added to closure capture lists. This would require enough engineering work that it seems unlikely that it would happen in the Swift 3 timeframe, and beyond that this could theoretically be subsumed into a more general system that allowed control-flow-like functions to have closures that break/continue/throw/return out of their enclosing function, or a general macro system.

Maybe the context has changed since then? I don't know.

4 Likes