[swift-evolution] Proposal: Always flatten the single element tuple

Xiaodi Wu xiaodi.wu at gmail.com
Wed Jun 7 08:28:53 CDT 2017


On Wed, Jun 7, 2017 at 08:20 Gwendal Roué <gwendal.roue at gmail.com> wrote:

>
> Le 7 juin 2017 à 15:11, Xiaodi Wu <xiaodi.wu at gmail.com> a écrit :
>
> While SE-0025 was generally regarded as unfortunate, the thousands of
> emails that followed relitigating it were much, much worse.
>
> The removal of implicit tuple splatting, which is *not* SE-0110, was
> approved on the understanding that it would be a regression until explicit
> tuple splatting is introduced. This tradeoff was considered and approved.
> It’s clear that you disagree, but that is not grounds to divert a necessary
> discussion on mitigating SE-0110 into relitigating something else.
>
>
> Push me out if you want, but will you push out those blatant wounds out as
> well?
>
> Example 1
> -        return columns.index { (column, _) in column.lowercased() ==
> lowercaseName }
> +        return columns.index { $0.0.lowercased() == lowercaseName }
>
> Example 2 :
> -            .map { (mappedColumn, baseColumn) -> (Int, String) in
> +            .map { (pair) -> (Int, String) in
> +                let mappedColumn = pair.key
> +                let baseColumn = pair.value
>
> Example 3 :
> -                .map { (table,
> columns) in "\(table)(\(columns.sorted().joined(separator: ", ")))" }
> +                .map { "\($0.key)(\($0.value.sorted().joined(separator:
> ", ")))" }
>
> Example 4 :
> -                dictionary.first { (column, value) in column.lowercased()
> == orderedColumn.lowercased() }
> +                dictionary.first { $0.key.lowercased() ==
> orderedColumn.lowercased() }
>

These *are* changes related to SE-0110, and Chris and others have already
proposed possibilities for sugar that could make this better. That’s
exactly the discussion that was originally started, to be distinguished
from the alternative in which you and others are proposing reversing 5 or 6
other proposals.

See also messages from Stephen Cellis, who shows how other kinds of
> developer code has lost expressivity and clarity with those changes that
> have been "considered and approved".
>
> Cheers,
> Gwendal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170607/58eb2537/attachment.html>


More information about the swift-evolution mailing list