[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"

Vladimir.S svabox at gmail.com
Thu Apr 21 02:10:51 CDT 2016


In this particular case I belive

func foo(int: Int) -> (Int) -> (String) -> String

is much more explicit and clear about what is what :

foo(int: Int) returns not Int(that returns then String and then String).

foo(int: Int) return function with (Int) parameter, that return func with 
(String) parameter that returns single String value.


On 20.04.2016 20:53, Chris Lattner via swift-evolution wrote:
>
>> On Apr 20, 2016, at 8:46 AM, BJ Homer <bjhomer at gmail.com> wrote:
>>
>> How would this proposal affect curried functions? Would this:
>>
>>  func foo(int: Int) -> Int -> String -> String
>>
>> become this?
>>
>>  func foo(int: Int) -> (((Int) -> String) -> String)
>
> No, it becomes:
>
> func foo(int: Int) -> (Int) -> (String) -> String
>
> -Chris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


More information about the swift-evolution mailing list