<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="">I’m not OP, but I imagine you can pattern match on the type. I don’t think that’s a compelling reason to add this feature though. I’d rather have&nbsp;<a href="https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/active-patterns" class="">active-patterns</a>&nbsp;for structs.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 2, 2017, at 3:13 PM, Slava Pestov 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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">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"><p class="" style="margin: 0px 0px 1.2em !important;">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<span class="Apple-converted-space">&nbsp;</span><code class="" 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-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;">Array&lt;…&gt;</code><span class="Apple-converted-space">&nbsp;</span>in the same way.</p><p class="" style="margin: 0px 0px 1.2em !important;"><code class="" 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-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;">newtype</code><span class="Apple-converted-space">&nbsp;</span>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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class="">Slava</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="markdown-here-wrapper"><pre class="" style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;"><code class="language-swift hljs" style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; white-space: pre; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em; color: rgb(51, 51, 51); background-color: rgb(248, 248, 248); display: block !important; background-position: initial initial; background-repeat: initial initial;">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(68, 85, 136); font-weight: bold;">Money</span>: <span class="hljs-title" style="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 class="" style="margin: 0px 0px 1.2em !important;">Here,<span class="Apple-converted-space">&nbsp;</span><code class="" 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-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;">getSelfFirst</code><span class="Apple-converted-space">&nbsp;</span>and<span class="Apple-converted-space">&nbsp;</span><code class="" 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-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline;">getSelfSecond</code><span class="Apple-converted-space">&nbsp;</span>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==" class="" style="height: 0px; width: 0px; max-height: 0px; max-width: 0px; overflow: hidden; font-size: 0em; padding: 0px; margin: 0px;"></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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></body></html>