[swift-evolution] Making capturing semantics of local

Alex Lynch lynch.sft at gmail.com
Fri Oct 27 14:15:15 CDT 2017


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?

Alex

On Fri, Oct 27, 2017 at 12:54 AM, Slava Pestov via swift-evolution <
swift-evolution at swift.org> wrote:

>
>
> On Oct 26, 2017, at 9:53 PM, Howard Lovatt via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> It would be easy to provide a fixit.
>
>
> That is still a source breaking change that requires migration, though.
>
> How often are they actually used? I rarely use them and all my use cases
> could be a closure instead.
>
> Also see Mike Kluev example; local functions are arguably worse than
> closures in all cases (provided that you can appropriately annotate the
> function type).
>
>
> Closures cannot replace all uses of local functions. Local functions can
> be recursive, and have a generic parameter list.
>
> Slava
>
>
>   -- Howard.
>
> On 27 October 2017 at 12:26, Slava Pestov <spestov at apple.com> wrote:
>
>>
>>
>> On Oct 26, 2017, at 4:45 PM, Howard Lovatt via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>> Rather than expand local function syntax why not deprecate local
>> functions completely
>>
>>
>> I don’t think at this point such a drastic change to the language is
>> likely to happen.
>>
>> Slava
>>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171027/58c7989d/attachment.html>


More information about the swift-evolution mailing list