[swift-evolution] [Proposal] Property behaviors
brent at architechies.com
Fri Dec 18 02:20:03 CST 2015
> We definitely can't have behaviors storing closures. Any closure that references `self` would then become a retain cycle.
If we could somehow enforce `unowned` capture of `self`, that wouldn’t be a problem.
> And of course for value types the closure would have captured an outdated copy of self.
Though this would be.
Perhaps the initializer closure should take `self` as a parameter, and so should any behavior method (at least as an option). So you would write `reset<Container>(inout container: Container)`, but you would call `propertyName.lazy.reset()`.
More information about the swift-evolution