[swift-evolution] Making capturing semantics of local

Mike Kluev mike.kluev at gmail.com
Sun Oct 29 07:39:41 CDT 2017


On 28 October 2017 at 23:45, Mike Kluev <mike.kluev at gmail.com> wrote:

> on Date: Fri, 27 Oct 2017 15:15:15 -0400 Alex Lynch <lynch.sft at gmail.com>
> wrote:
>
> I use local functions heavily in my day-to-day workflow and an very
>> interested in them supporting capture lists.
>> Here is a draft feature specification:
>> https://bitbucket.org/snippets/lynchrb/r487zn
>>
>> Anyone see any weak spots?
>>
>
following C tradition to have declarations mimicking usage, the
weak/unowned specifier shall be on the left to the name, as the "self"
itself is on the left: self.foo

maybe a too wild idea, but how about this:

weak func foo() {
   ...
}

as a special case of "weak self" specifier. instead of:

func foo() { [weak self] in
   ...
}

of course it doesn't address everything that can be achieved by general
capture list specifiers.

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171029/6a4bc6ea/attachment.html>


More information about the swift-evolution mailing list