[swift-evolution] [pitch] Eliminate the "T1 -> T2" syntax, require "(T1) -> T2"
antonyzhilin at gmail.com
Sat Apr 23 05:47:03 CDT 2016
> Therefore the impermissible:
> (()) -> () Is identical to:
> (Void) -> () So to follow these rules, it must instead be:
> Void -> () … and we’re back to T1 -> T2 :* )*
Wrong! If we enforce parentheses in function types, we won't be able to write
Void -> ()
Parentheses will be required on the grammar level. The correct way to
write this will be:
() -> () or () -> Void
The following will be legal:
(Void) -> () and (()) -> ()
It is a function that takes a single parameter () and returns ().
I additionally propose that the following should be illegal, because
additional parentheses aren't needed there:
((())) -> () and () -> (()) and just (Int) and (())
Hope it cleared up things a little bit.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution