[swift-evolution] Required Callback
brent at architechies.com
Wed Aug 17 07:43:02 CDT 2016
> On Aug 16, 2016, at 12:44 PM, James Campbell via swift-evolution <swift-evolution at swift.org> wrote:
> That sounds fair, the closure that function returns could trigger a runtime warning when it detects the closure has be deallocated without being triggered (or even mutliple times but ofc not the focus for this proposal)
You know, I'm thinking about that "multiple times" thing...
We know we want a @once (formerly @noescape(once)) for closures which are guaranteed to be called exactly once. This would help us with initializing variables, and especially properties, from a closure. Perhaps we should extend that to support @escaping @once. Would that handle these use cases? Are there use cases for @required where you expect more than one call? I think all of the use cases we've discussed here—ending handlers and such—should only be called once.
More information about the swift-evolution