<div dir="ltr">On Thu, May 25, 2017 at 1:27 PM, John McCall via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail-">> On May 25, 2017, at 2:23 PM, Nevin Brackett-Rozinsky via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
> One possibility is to make parentheses consistently meaningful in closure argument lists, so that “(a, b)” would exclusively mean “there is one parameter of tuple-type, which is being destructured”, while “a, b” without parentheses would exclusively mean “there are two parameters”.<br>
><br>
> That way you can destructure a tuple parameter if you wish (by using parentheses) or you can leave the tuple intact (by listing a single identifier without parentheses).<br>
<br>
</span>The problem with this is that we also need some way to be explicit about the return type, and it would be strange to allow (and require!)<br>
{ a, b -> Int in }<br>
when that's not at all a valid way to write a function type. Also it would be an enormous source break, even worse than this problem.<br>
<br>
That said, I'm quite sympathetic to the idea that directly destructuring tuples in closure parameter lists is too useful to lose, even if it's ambiguous.<br></blockquote><div><br></div><div>The option of using the keyword let to disambiguate, proposed somewhere above or on GitHub, is attractive here:</div><div><br></div><div>{ (a, b) -> Int in } // two parameters<br></div><div><div>{ let (a, b) -> Int in } // destructuring one parameter</div></div><div><br></div><div>{ a, let (b, c) -> Int in } // destructuring two parameters</div><div>{ let a, (b, c) -> Int in } // still destructuring two parameters</div><div>{ let (a, (b, c)) -> Int in } // destructuring one parameter</div><div>{ (a, (b, c)) -> Int in } // error: add 'let' to destructure second parameter</div><div><br></div></div></div></div>