[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.
- Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160423/07c8952b/attachment.html>
More information about the swift-evolution
mailing list