<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br></div><div>On 7 May 2017, at 00:21, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div>To which human would it be misleading?<br><br>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.<br><br>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.<br></div></blockquote><div><br></div><div>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.</div><br><blockquote type="cite"><div><div class="gmail_quote"><div dir="ltr">On Sat, May 6, 2017 at 16:28 Brent Royal-Gordon <<a href="mailto:brent@architechies.com">brent@architechies.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> On May 5, 2017, at 11:06 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br>
><br>
> The identifier after a colon is *never* a type in any pattern matching, and there's no need of which I'm aware to support type annotations in pattern matching. We put colons after labels, and the current syntax is perfectly consistent here. What is the defect you're trying to cure?<br>
<br>
The defect underlying this proposal: `let (x: Int, y: Double)` looks like it's declaring `x` and `y` of types `Int` and `Double`, but it's actually declaring `Int` and `Double` and binding them to `x` and `y`. Your code's meaning is perfectly unambiguous to the compiler, of course, but it's misleading to the human.<br>
<br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
<br>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>