[swift-evolution] Proposal: Always flatten the single element tuple
Susan Cheng
susan.doggie at gmail.com
Tue Jun 6 23:00:01 CDT 2017
a PR is create: https://github.com/apple/swift-evolution/pull/722
2017-06-07 10:15 GMT+08:00 Susan Cheng <susan.doggie at gmail.com>:
> Introduction
>
> Because the painful of SE-0110, here is a proposal to clarify the tuple
> syntax.
>
> Proposed solution
> 1. single element tuple always be flattened
>
> let tuple1: (((Int))) = 0 // TypeOf(tuple1) == Int
>
>
> let tuple2: ((((Int))), Int) = (0, 0) // TypeOf(tuple2) == (Int, Int)
>
> 2. function arguments list also consider as a tuple, which means the
> function that accept a single tuple should always be flattened.
>
> let fn1: (Int, Int) -> Void = { _, _ in }
>
>
> let fn2: ((Int, Int)) -> Void = { _, _ in } // always flattened
>
> let fn3: (Int, Int) -> Void = { _ in } // not allowed, here are two
> arguments
>
> let fn4: ((Int, Int)) -> Void = { _ in } // not allowed, here are two
> arguments
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170607/b91cdd23/attachment.html>
More information about the swift-evolution
mailing list