<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>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><br></div><div>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><br>On Dec 28, 2016, at 5:09 AM, Anton Zhilin 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><div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">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>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-swift" 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;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="hljs-func"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">func</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold">position</span><span class="hljs-params">()</span> -&gt; <span class="hljs-params">(x: Int, y: Int)</span> </span>{
    <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">return</span> (x: <span class="hljs-number" style="color:rgb(0,128,128)">0</span>, y: <span class="hljs-number" style="color:rgb(0,128,128)">0</span>)
}

<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> (y, x) = position()
</code></pre>
<p style="margin:0px 0px 1.2em!important">(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">Point</code> struct. Let’s pretend those two parameters don’t make sense as a struct.)</p>
<p style="margin:0px 0px 1.2em!important">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">out</code> parameters <strong>and</strong> make them the default for multiple returns for Swift 4. The syntax would look like:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-swift" 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;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="hljs-func"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">func</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold">position</span><span class="hljs-params">(x: out Int, y: out Int)</span> </span>{
    x = <span class="hljs-number" style="color:rgb(0,128,128)">0</span>
    y = <span class="hljs-number" style="color:rgb(0,128,128)">0</span>
}

<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> y
position(x: <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> x, y: y)
</code></pre>
<p style="margin:0px 0px 1.2em!important"><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">out</code> arguments can be any patterns allowed on the left side of assignment, including wildcard pattern and tuple destructu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48YnI+PC9kaXY+PGRpdj5gYGBzd2lmdDwvZGl2PjxkaXY+ZnVuYyBw
b3NpdGlvbih4OiBvdXQgSW50LCB5OiBvdXQgSW50KSB7PC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7
IHggPSAwPC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IHkgPSAwPC9kaXY+PGRpdj59PC9kaXY+PGRp
dj48YnI+PC9kaXY+PGRpdj52YXIgeTwvZGl2PjxkaXY+cG9zaXRpb24oeDogbGV0IHgsIHk6IHkp
PC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PmBvdXRgIGFyZ3VtZW50cyBj
YW4gYmUgYW55IHBhdHRlcm5zIGFsbG93ZWQgb24gdGhlIGxlZnQgc2lkZSBvZiBhc3NpZ25tZW50
LCBpbmNsdWRpbmcgd2lsZGNhcmQgcGF0dGVybiBhbmQgdHVwbGUgZGVzdHJ1Y3R1cmluZyBwYXR0
ZXJuLjxicj48L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></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>