<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 2, 2017, at 3:24 AM, Anton Zhilin 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=""><div dir="ltr" class=""><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important" class="">I think that tuples should remain what they are now. Static-length vectors should be types on their own and interact with tuples, with structs and with <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="">Array&lt;…&gt;</code> in the same way.</p><p style="margin:0px 0px 1.2em!important" class=""><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="">newtype</code> should be what enables extension of tuples:</p><div class=""><br class=""></div></div></div></div></blockquote>Does newtype add any new capability that’s not already covered by defining a struct?</div><div><br class=""></div><div>Slava</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="markdown-here-wrapper" style="">
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px" class=""><code class="language-swift hljs" 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)">newtype <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Money</span> = (<span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Int</span>, <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Int</span>)

<span class="hljs-class"><span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">extension</span> <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">Money</span>: <span class="hljs-title" style="color:rgb(153,0,0);font-weight:bold;color:rgb(68,85,136);font-weight:bold">CustomStringConvertible</span> </span>{
    <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">var</span> description: <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">String</span> {
        <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">return</span> <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">String</span>(format: <span class="hljs-string" style="color:rgb(221,17,68)">"$%d.%02d"</span>, arguments: [getSelfFirst, getSelfSecond])
    }
}

<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> x = (<span class="hljs-number" style="color:rgb(0,128,128)">0</span>, <span class="hljs-number" style="color:rgb(0,128,128)">42</span>)
<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> y = x <span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">as</span> <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Money</span>  <span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// error</span>
<span class="hljs-built_in" style="color:rgb(0,134,179)">print</span>(x.description)  <span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">// error</span>

<span class="hljs-keyword" style="color:rgb(51,51,51);font-weight:bold">let</span> z = <span class="hljs-type" style="color:rgb(68,85,136);font-weight:bold">Money</span>(<span class="hljs-number" style="color:rgb(0,128,128)">0</span>, <span class="hljs-number" style="color:rgb(0,128,128)">42</span>)
<span class="hljs-built_in" style="color:rgb(0,134,179)">print</span>(z.description)  <span class="hljs-comment" style="color:rgb(153,153,136);font-style:italic">//=&gt; $0.42</span>
</code></pre><p style="margin:0px 0px 1.2em!important" class="">Here, <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="">getSelfFirst</code> and <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="">getSelfSecond</code> are placeholders for some syntax to access the underlying type.</p>
<div title="MDH:SSB0aGluayB0aGF0IHR1cGxlcyBzaG91bGQgcmVtYWluIHdoYXQgdGhleSBhcmUgbm93LiBTdGF0
aWMtbGVuZ3RoIHZlY3RvcnMgc2hvdWxkIGJlIHR5cGVzIG9uIHRoZWlyIG93biBhbmQgaW50ZXJh
Y3Qgd2l0aCB0dXBsZXMsIHdpdGggc3RydWN0cyBhbmQgd2l0aCBgQXJyYXkmbHQ74oCmJmd0O2Ag
aW4gdGhlIHNhbWUgd2F5LjxkaXY+PGJyPjwvZGl2PjxkaXY+YG5ld3R5cGVgIHNob3VsZCBiZSB3
aGF0IGVuYWJsZXMgZXh0ZW5zaW9uIG9mIHR1cGxlczo8L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2
PmBgYHN3aWZ0PC9kaXY+PGRpdj5uZXd0eXBlIE1vbmV5ID0gKEludCwgSW50KTwvZGl2PjxkaXY+
PGJyPjwvZGl2PjxkaXY+ZXh0ZW5zaW9uIE1vbmV5OiBDdXN0b21TdHJpbmdDb252ZXJ0aWJsZSB7
PC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IHZhciBkZXNjcmlwdGlvbjogU3RyaW5nIHs8L2Rpdj48
ZGl2PiZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyByZXR1cm4gU3RyaW5nKGZvcm1hdDogIiQl
ZC4lMDJkIiwgYXJndW1lbnRzOiBbZ2V0U2VsZkZpcnN0LCBnZXRTZWxmU2Vjb25kXSk8L2Rpdj48
ZGl2PiZuYnNwOyAmbmJzcDsgfTwvZGl2PjxkaXY+fTwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+
bGV0IHggPSAoMCwgNDIpPC9kaXY+PGRpdj5sZXQgeSA9IHggYXMgTW9uZXkgJm5ic3A7Ly8gZXJy
b3I8L2Rpdj48ZGl2PnByaW50KHguZGVzY3JpcHRpb24pICZuYnNwOy8vIGVycm9yPC9kaXY+PGRp
dj48YnI+PC9kaXY+PGRpdj5sZXQgeiA9IE1vbmV5KDAsIDQyKTwvZGl2PjxkaXY+cHJpbnQoei5k
ZXNjcmlwdGlvbikgJm5ic3A7Ly89Jmd0OyAkMC40MjwvZGl2PjxkaXY+YGBgPC9kaXY+PGRpdj48
YnI+PC9kaXY+PGRpdj5IZXJlLCBgZ2V0U2VsZkZpcnN0YCBhbmQgYGdldFNlbGZTZWNvbmRgIGFy
ZSBwbGFjZWhvbGRlcnMgZm9yIHNvbWUgc3ludGF4IHRvIGFjY2VzcyB0aGUgdW5kZXJseWluZyB0
eXBlLjwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0" class="">​</div></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=""></body></html>