> On Nov 16, 2017, at 3:07 PM, Howard Lovatt via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> Where I am proposing a change is that if a closure with generic arguments is 
> encountered it is transformed into the equivalent struct and the struct is 
> typed as it currently is (or if there is a better implementation something 
> equivalent to this), therefore zero change to the type system.

Since we already have local functions that can capture values and be generic, 
there’s no need to implement a new mechanism for name mangling or handling of 
captures.

> 
> The changes proposed are a transformation into a struct and name mangling, 
> e.g.:
> 
>     let increment: <T>(T) throws -> T where T: Numeric = { $0 + 1 }
>     let increment = { <T>(n: T) throws -> T where T: Numeric in n + 1 }
>     let increment: <T>(T) throws -> T where T: Numeric = { <T>(n: T) throws 
> -> T where T: Numeric in n + 1 }

It sounds like what you’re proposing is essentially a new surface syntax for 
local functions — since a generic closure would not be a first class value, it 
could not appear anywhere except for the right hand side of a let binding, 
right?

Slava
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to