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

Chris Lattner clattner at apple.com
Sat Apr 16 23:31:28 CDT 2016


> On Apr 16, 2016, at 8:48 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Apr 16, 2016, at 10:10 AM, Patrick Gili <gili.patrick.r at gili-labs.com> wrote:
>> 
>> As an alternative, could we require the parens on the return. For example:
>> 
>> (Int) -> (Float)
>> (String) -> ()
>> () -> ()
>> () -> (Double)
>> 
>> This looks cleaner, improves consistency, and simplifies the syntax (i.e., no need to remember when parens are necessary).
> 
> -1 from me.  And the rationale that I provided for this pitch doesn’t support it: unlike arguments, return types really are just types, they don’t align with other syntactic productions that have magic argument behavior.
> 
> I’ll write up a formal proposal for more discussion.

Here is the proposal:
https://github.com/apple/swift-evolution/blob/master/proposals/0066-standardize-function-type-syntax.md

We can discuss this more when it is scheduled for review.

Thanks all,

-Chris


More information about the swift-evolution mailing list