[swift-evolution] Proposal: Closures capture weak by default

Andrew Bennett cacoyi at gmail.com
Tue Dec 8 17:26:42 CST 2015


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> 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 (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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151209/f1425a2a/attachment.html>


More information about the swift-evolution mailing list