[swift-evolution] Making capturing semantics of local

Mike Kluev mike.kluev at gmail.com
Fri Oct 27 12:51:28 CDT 2017


On Thu, 26 Oct 2017 21:54:37 -0700 Slava Pestov <spestov at apple.com> wrote:

>
> Closures cannot replace all uses of local functions. Local functions can
> be recursive, and have a generic parameter list.
>
>
FTM, local functions do not help with "keep functions short" and "keep
indentation level small" rules of thumb.

what are the actual benefits of local vs non local functions? locality
principle? (define something where it is used). but we do not have it in
much more important cases, say, with static variables - we have to declare
them outside of functions. ditto for normal variables in extensions - no
matter how carefully i group functions in individual extensions based on
their purpose -- potentially in different files -- it all breaks once i
need to add a single variable to that group which i have to to in the class
itself.

what would be the damage if we remove local functions altogether, would we
lose anything really useful? aside from the fact that "it is too late at
this stage" i mean (which is appreciated).

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


More information about the swift-evolution mailing list