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

Brent Royal-Gordon brent at architechies.com
Mon May 8 03:08:10 CDT 2017


> On May 8, 2017, at 12:09 AM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> Highly disagree. Consistency teaches us that variables can come after a colon.

But not normally in a declaration.

> On May 8, 2017, at 12:28 AM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> Yes, Robert came up with a very clever puzzle. I'll bet you there are *plenty* of neat puzzles that you can come up with if you start naming your variables `Int` and `Double`.

Sure, but how many of them look *so much* like a declaration that, even knowing there's a puzzle, you still don't guess what's going on? Because that was my experience with his "puzzle".

I know that Swift pattern matching is based on the idea that the pattern looks like the code used to construct the value it matches. But in the case of capturing values from labeled paren lists, I think it leads to deeply confusing code. We already knew about the weirdness of `as` in pattern matches, but this is even worse.

I think we ought to reconsider what we're doing in this area, and perhaps move more towards a syntax that echoes declaration rather than use. When a piece of syntax *really* looks like it does A, even to experienced users, but it actually does B, that's a sign that it's the wrong syntax.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170508/742c82ee/attachment.html>


More information about the swift-evolution mailing list