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

Антон Жилин antonyzhilin at gmail.com
Fri Apr 22 16:52:18 CDT 2016


We can disallow putting types in parentheses in single-element tuple
meaning.
For example, (Int) -> (Double) will be illegal because of (Double).
(Int) -> (Double) -> Bool will be legal, because parentheses mean function
type here.
(Int) -> () will be legal, because () means Void here.
This can be theme of a separate proposal.

- Anton

On 22.04.16, Vladimir.S wrote:

What I really don't like is that we can have all this:
func f1() -> (Void) {..}
func f2(Void) -> ((Void)) {..}
func f3() -> (((()))) {..}
func f4(((Void))) -> (Void) {..}
func f5() -> ((Void)) {..}
func f6((())) -> (((()))) {..}
and all is equivalent for
func f() -> () {..}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160423/ebef951a/attachment.html>


More information about the swift-evolution mailing list