<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I wish that we had gone in the other direction and let functions allow destructuring of parameters. That said, I guess I can see how that chance left when we decided to move away from function parameters as tuples.<br><br>TJ&nbsp;</div><div><br>On May 25, 2017, at 02:08, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On May 24, 2017, at 12:12 PM, Tony Parker via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi everyone,<div class=""><br class=""></div><div class="">We received a pull request in swift-corelibs-foundation which is apparently in response to a language change for SE-0110.</div><div class=""><br class=""></div><div class="">It turns this perfectly reasonable code:</div><div class=""><div class=""><br class=""></div><div class=""><font face="Menlo" class="">- &nbsp; &nbsp; &nbsp; &nbsp;self.forEach&nbsp;{ (keyItem, valueItem)&nbsp;in</font></div><div class=""><br class=""></div><div class="">into this:</div><div class=""><br class=""></div><div class=""><br class=""><font face="Menlo" class="">+ &nbsp; &nbsp; &nbsp; &nbsp;self.forEach&nbsp;{ (arg)&nbsp;in<br class="">+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;let&nbsp;(keyItem, valueItem)&nbsp;=&nbsp;arg<br class=""></font><br class="">Is that really the design pattern we want to encourage? What was wrong with the previous code?</div></div></div></div></blockquote><br class=""></div><div>For consistency, the decision was to make closure parameter lists work the same way as function parameters. &nbsp;Function parameters do not allow destructuring of arguments in their declaration, so it seemed weird to let closures do that.</div><div><br class=""></div><div>Similarly, this doesn’t compile either:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self.ForEach(functionTakingTwoParameters)</div><div><br class=""></div><div>even if the two parameters are equivalent to the element type of the self Sequence</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""></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>