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

Gwendal Roué gwendal.roue at gmail.com
Wed Jun 7 08:20:19 CDT 2017


> 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() }

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/3a2d70ab/attachment.html>


More information about the swift-evolution mailing list