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

Erica Sadun erica at ericasadun.com
Tue Apr 19 09:49:36 CDT 2016


> On Apr 18, 2016, at 4:31 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> 
> on Fri Apr 15 2016, Brent Royal-Gordon <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>>> Given all this, I think it makes sense to go for syntactic
>>> uniformity between parameter list and function types, and just
>>> require parenthesis on the argument list.  The types above can be
>>> trivially written as:
>>> 
>>> (Int) -> Float
>>> (String) -> ()
>>> 
>>> Thoughts?
>> 
>> While it's technically correct, I agree with John's assessment that
>> this is "fussy". `T -> U` doesn't confuse people 
> 
> Do we have any data on this (in either direction)?
> 
> Personally, it has always seemed obvious that T -> U being a function
> type would be quite novel to some people, considering the number of
> times I've seen in Haskell texts that (surprise!) you don't need
> parentheses to invoke functions.  I guess those are invocations and
> we're talking about declarations here, but declaration-follows-use is a
> kind of principle the language tries to uphold.
> 
> But that's just intuition.  Data would be very interesting.

Apart from intuition and confusion, parentheses are used at call sites
and declarations. It seems out of line that they can be removed in types 
but only in one degenerate case.

This goes against the Swift core design goal of consistency.

-- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160419/4dc7a57e/attachment.html>


More information about the swift-evolution mailing list