[swift-evolution] [Pitch] Improving capturing semantics of	local functions
    Slava Pestov 
    spestov at apple.com
       
    Wed Nov 15 00:01:24 CST 2017
    
    
  
> On Nov 14, 2017, at 6:56 PM, Howard Lovatt via swift-evolution <swift-evolution at swift.org> wrote:
> 
>   2. Allow closures when assigned to a function type to be:
>       2a. Recursive.
Local functions can also be mutually recursive:
func f() {
  func foo() { bar() }
  func bar() { foo() }
}
This would not work with let bindings, which are not visible before the location where they are defined.
>       2b. Annotatable with:
>             2bi.  @inline
Neither closures nor local functions benefit from being annotated with @_inlineable, because they can only be referenced from inside their defining function, and not across module boundaries. So the optimizer can already inline the function or closure if needed.
>             2bii. @escaping
>       2c. Generic.
See my other response to this thread.
Slava
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171114/b48c7ecf/attachment.html>
    
    
More information about the swift-evolution
mailing list