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

Jeremy Pereira jeremy.j.pereira at googlemail.com
Thu Apr 21 06:42:46 CDT 2016


> On 20 Apr 2016, at 15:40, Erica Sadun <erica at ericasadun.com> wrote:
> 
> 
>> On Apr 20, 2016, at 5:09 AM, Jeremy Pereira <jeremy.j.pereira at googlemail.com> wrote:
>> 
>> 
>>> On 19 Apr 2016, at 17:24, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>>> 
>>> Short of a complete rethink of closure syntax, requiring parentheses there would not improve the language in any measurable way.
>> 
>> Does requiring the parentheses in (T1) -> T2 improve the language in any measurable way?
> 
> I believe it does, as the parens are already required at call sites and in function declarations, and when using functions with more than one argument.

I’m sorry, but the one statement does not follow from the other. That parentheses are required at call sites and in function declarations (NB: but not in closure definitions) does not imply that the language would be measurably improved by mandating them in function type declarations of the form T1 -> T2 as well.

In fact, it seems to me, that, generally, the language designers took the opposite point of view, namely that the language is measurably improved by allowing coders to omit syntax where the omission does not result in ambiguity. For instance, we can omit the statement terminator for the last statement on a line, type annotations for let and var identifiers where the type can be inferred, pretty much everything in a closure’s parameter and return type declaration.


More information about the swift-evolution mailing list