[swift-evolution] Proposal: Closures capture weak by default
jordan_rose at apple.com
Tue Dec 8 17:56:40 CST 2015
IMO, this has been one of many reasons why Swift doesn't have flags for its warnings yet: we do not want to fracture the language into dialects based on style, and we'd rather not have one person's code spew warnings in another person's build. (Admittedly, the warnings could be controlled by package preferences, but still.)
> On Dec 8, 2015, at 15:26, Andrew Bennett via swift-evolution <swift-evolution at swift.org> wrote:
> Perhaps this is something where we could have a few compiler options to handle different preferences.
> You could have options like:
> * -Wexplicit-owner-capture (for explicit self)
> * -Wexplicit-capture (for explicit non-trivial references)
> On Wed, Dec 9, 2015 at 10:15 AM, Kevin Ballard <kevin at sb.org <mailto:kevin at sb.org>> wrote:
> On Tue, Dec 8, 2015, at 02:57 PM, Andrew Bennett wrote:
>> Kevin, I think you should definitely propose that (weak in outer and inner closure), it's one of the surprises that led me to this proposal. I also really like your suggesting of requiring explicit weak/strong on self, I think this could solve many cases.
> I submitted the proposal as https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001134.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001134.html> (unfortunately it looks like the plain text version got garbled :/).
> Regarding explicit weak/strong, my feeling is it would probably get too annoying to have to type `[self] in` everywhere. But it may be worth playing with.
> -Kevin Ballard
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution