[swift-evolution] Proposal: Allow `[strong self]` capture in closures and remove the `self` requirement therein
drew at sealedabstract.com
Tue Dec 15 19:23:27 CST 2015
> On Dec 15, 2015, at 7:15 PM, Greg Parker <gparker at apple.com> wrote:
> We could make it more difficult for unaware programmers to *write* the `[strong self]` version, at least. When a programmer writes just `metadata` in a closure, the compiler could continue to suggest using `self.metadata` and not suggest using `[strong self]`.
That's not (especially) the danger I'm worried about.
I'm worried about the case where I write `[strong self] in` and then years later I add the `evil(f)` to the bottom of the closure, because it turns out we need more code in there.
I'm also worried about the case where I write nonEvil(f) but at some later time the implementation of nonEvil(f) becomes evil.
I'm also worried about the case where nonEvil(f) is a call into closed-source UIKit and without any visibility to me, UIKit's implementation of nonEvil becomes evil between iOS10b3 and iOS10b4.
These things are "category 5" bugs waiting to happen, and they can't be competently addressed with a UI-level fix in Xcode.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution