<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Totally against out params. Returning tuples is way more logical & understandable<div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">BR</div><div class="">Dominik</div><div class=""><br class=""></div><div class="">Web: <a href="https://pich.info" class="">https://pich.info</a></div><div class="">Twitter: @DaijDjan</div><div class="">Facebook: Dominik.Pich</div></div></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 28 Dec 2016, at 15:06, Daniel Leping via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">-1 here. What's wrong with tuples? Don't kill functional approach</div><div class=""><br class=""><div class="gmail_quote"><div class="">On Wed, 28 Dec 2016 at 19:35 Micah Hainline via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg"><div class="gmail_msg"></div><div class="gmail_msg">You haven't really explained what problem this solves, and it would have to be a pretty big one to justify such a change.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I'm -1 on this, until a compelling argument is made. This feels like just liking the syntax of another language and wanting it in Swift.</div></div><div class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg">On Dec 28, 2016, at 5:09 AM, Anton Zhilin via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg m_5871273881087162446markdown-here-wrapper"><p style="margin:0px 0px 1.2em!important" class="gmail_msg">Some people on the list wondered, why we have moved from tuples in function parameters, but multiple returns are still implemented using tuples? The following code still compiles:</p><br class=""><br class=""><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="gmail_msg m_5871273881087162446language-swift m_5871273881087162446hljs" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="gmail_msg m_5871273881087162446hljs-func"><span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">func</span> <span class="m_5871273881087162446hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold">position</span><span class="gmail_msg m_5871273881087162446hljs-params">()</span> -> <span class="gmail_msg m_5871273881087162446hljs-params">(x: Int, y: Int)</span> </span>{<br class=""><br class=""> <span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">return</span> (x: <span class="m_5871273881087162446hljs-number gmail_msg" style="color:rgb(0,128,128)">0</span>, y: <span class="m_5871273881087162446hljs-number gmail_msg" style="color:rgb(0,128,128)">0</span>)<br class=""><br class="">}<br class=""><br class=""><br class=""><br class=""><span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> (y, x) = position()<br class=""><br class=""></code></pre><br class=""><br class=""><p style="margin:0px 0px 1.2em!important" class="gmail_msg">(Maybe it’s a bad example, because naturally we’d use <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">Point</code> struct. Let’s pretend those two parameters don’t make sense as a struct.)</p><br class=""><br class=""><p style="margin:0px 0px 1.2em!important" class="gmail_msg">What I want to discuss is if we should introduce <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">out</code> parameters <strong class="gmail_msg">and</strong> make them the default for multiple returns for Swift 4. The syntax would look like:</p><br class=""><br class=""><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class="gmail_msg"><code class="gmail_msg m_5871273881087162446language-swift m_5871273881087162446hljs" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span class="gmail_msg m_5871273881087162446hljs-func"><span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">func</span> <span class="m_5871273881087162446hljs-title gmail_msg" style="color:rgb(153,0,0);font-weight:bold">position</span><span class="gmail_msg m_5871273881087162446hljs-params">(x: out Int, y: out Int)</span> </span>{<br class=""><br class=""> x = <span class="m_5871273881087162446hljs-number gmail_msg" style="color:rgb(0,128,128)">0</span><br class=""><br class=""> y = <span class="m_5871273881087162446hljs-number gmail_msg" style="color:rgb(0,128,128)">0</span><br class=""><br class="">}<br class=""><br class=""><br class=""><br class=""><span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> y<br class=""><br class="">position(x: <span class="gmail_msg m_5871273881087162446hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> x, y: y)<br class=""><br class=""></code></pre><br class=""><br class=""><p style="margin:0px 0px 1.2em!important" class="gmail_msg"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline" class="gmail_msg">out</code> arguments can be any patterns allowed on the left side of assignment, including wildcard pattern and tuple destructuring pattern.</p><br class=""><br class=""><div title="MDH:PGRpdj5Tb21lIHBlb3BsZSBvbiB0aGUgbGlzdCB3b25kZXJlZCwgd2h5IHdlIGhhdmUgbW92ZWQg<br><br>ZnJvbSB0dXBsZXMgaW4gZnVuY3Rpb24gcGFyYW1ldGVycywgYnV0IG11bHRpcGxlIHJldHVybnMg<br><br>YXJlIHN0aWxsIGltcGxlbWVudGVkIHVzaW5nIHR1cGxlcz8gVGhlIGZvbGxvd2luZyBjb2RlIHN0<br><br>aWxsIGNvbXBpbGVzOjxicj48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PmBgYHN3aWZ0PC9kaXY+<br><br>PGRpdj48ZGl2PmZ1bmMgcG9zaXRpb24oKSAtJmd0OyAoeDogSW50LCB5OiBJbnQpIHs8L2Rpdj48<br><br>ZGl2PiZ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Bj<br><br>YW4gYmUgYW55IHBhdHRlcm5zIGFsbG93ZWQgb24gdGhlIGxlZnQgc2lkZSBvZiBhc3NpZ25tZW50<br><br>LCBpbmNsdWRpbmcgd2lsZGNhcmQgcGF0dGVybiBhbmQgdHVwbGUgZGVzdHJ1Y3R1cmluZyBwYXR0<br><br>ZXJuLjxicj48L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0" class="gmail_msg"></div></div></div><br class=""><br class=""></div></blockquote><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg">_______________________________________________</span><br class="gmail_msg"><span class="gmail_msg">swift-evolution mailing list</span><br class="gmail_msg"><span class="gmail_msg"><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="gmail_msg"><span class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class="gmail_msg"></div></blockquote></div>_______________________________________________<br class="gmail_msg"><br class="">swift-evolution mailing list<br class="gmail_msg"><br class=""><a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg"><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg"><br class=""></blockquote></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>