> 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()`.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to