[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles

Xiaodi Wu xiaodi.wu at gmail.com
Mon May 8 02:09:04 CDT 2017

On Mon, May 8, 2017 at 12:16 AM, David Hart <david at hartbit.com> wrote:

> On 7 May 2017, at 00:21, Xiaodi Wu via swift-evolution <
> swift-evolution at swift.org> wrote:
> To which human would it be misleading?
> To the writer? No, because the compiler will warn you right away. By the
> time you're done with writing the first line, it'll warn you that Int and
> Double are unused variables. And if you try to use x and y, you get an
> error.
> To the reader? Only if the writer knowingly wrote this misleading code. In
> other words, it's a nice puzzle, but no reader will encounter this in
> real-world code, unless they're being tormented by the writer on purpose.
> IMHO, the fact that the compiler warns you does no change the fact that
> it's a very confusing part of the language. It should not be an excuse for
> fixing it. Consistency teaches us to expect a type after a colon.

Highly disagree. Consistency teaches us that variables can come after a

func foo(bar: Int, baz: Int) {
  print(bar, baz)

func foo(bar: Bool, baz: Bool) {
  print(bar, baz)

let x = 42
let y = 43
foo(bar: x, baz: y)
// x and y are variables, and they come after the colon.
// We don't allow users to write `foo(bar x: Int, baz y: Int)`,
// even when there are overloads.

There is nothing inconsistent about this part of the language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170508/863686b4/attachment.html>

More information about the swift-evolution mailing list