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

Chris Lattner clattner at apple.com
Sun Apr 24 17:04:48 CDT 2016


> On Apr 22, 2016, at 4:05 PM, Vladimir.S <svabox at gmail.com> wrote:
> 
> After some discussions, I support this proposal and think this will make Swift more consistent and clear about where is parameters and where is result type. Especially this important in code like:
> Int -> String -> Void -> Float
> which IMO should be
> (Int) -> (String) -> (Void) -> Float
> as Int/String/Void are parameters, Float is result type.
> 
> But IMO not just "require parenthesis on the argument list", but also disallow parenthesis in result type in meaning of tuple of single argument(as we discussed in this thread with @Anton), disallow placing () in (), disallow Void in () in result - to prevent all these ((((())))) (((Void))) etc in parameters and in result type.
> 
> @Chris, would you form a proposal for this subject?

Yes, I already did:
https://github.com/apple/swift-evolution/blob/master/proposals/0066-standardize-function-type-syntax.md

It isn’t currently scheduled, but when it comes up, we can have more discussion about it.

-Chris


More information about the swift-evolution mailing list