<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=""><div><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 4:07 PM, Nikolai Vazquez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><p dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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="">I was thinking it could work for variables that are already tuples but then that goes against Swift's strict typing. So really it should only be for tuple literals.<br class=""></p></div></blockquote><div><br class=""></div>I think this is an interesting idea, but I believe it’s not actually expressible in the current generics system without hard-coding the protocol to just 2-tuples.</div><div><br class=""></div><div>John.</div><div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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;"><div dir="ltr" class="">On Sun, Dec 6, 2015, 7:01 PM&nbsp;Stephen Celis &lt;<a href="mailto:stephen.celis@gmail.com" class="">stephen.celis@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="">Do you mean a TupleLiteralConvertible? I’m also in favor of a ClosureLiteralConvertible (or FunctionLiteralConvertible).<div class=""><br class=""></div><div class="">Stephen<br class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""></blockquote></div></div></div></div><div style="word-wrap: break-word;" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 6, 2015, at 6:40 PM, Nikolai Vazquez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""></blockquote></div></div></div></div><div style="word-wrap: break-word;" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><p style="margin: 0px 0px 1.2em !important;" class="">When working with points, I’ll sometimes make a<span class="Apple-converted-space">&nbsp;</span><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); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">typealias</code><span class="Apple-converted-space">&nbsp;</span>to an integer tuple:</p><pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; white-space: pre-wrap; 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;" class=""><span style="color: rgb(51, 51, 51); font-weight: bold;" class="">typealias</span> <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Point</span> = (x: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>, y: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>)
</code></pre><p style="margin: 0px 0px 1.2em !important;" class="">However, if I want to add extended functionality to my<span class="Apple-converted-space">&nbsp;</span><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); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">Point</code><span class="Apple-converted-space">&nbsp;</span>type, I would have to change it to a<span class="Apple-converted-space">&nbsp;</span><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); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">struct</code>, removing the ability to create one on the fly with a tuple.</p><p style="margin: 0px 0px 1.2em !important;" class="">I’m proposing a<span class="Apple-converted-space">&nbsp;</span><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); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">TupleConvertible</code><span class="Apple-converted-space">&nbsp;</span>protocol that allows initialization from a tuple directly.</p><pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; white-space: pre-wrap; 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;" class=""><span class=""><span style="color: rgb(51, 51, 51); font-weight: bold;" class="">struct</span> <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Point</span>: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">TupleConvertible</span> </span>{

    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">var</span> x, y: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>

    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">init</span>(x: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>, y: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>) {
        <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">self</span>.x = x
        <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">self</span>.y = y
    }

    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">init</span>(tuple: (x: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>, y: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Int</span>)) {
        <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">self</span>.<span style="color: rgb(51, 51, 51); font-weight: bold;" class="">init</span>(x: tuple.x, y: tuple.y)
    }

}
</code></pre><p style="margin: 0px 0px 1.2em !important;" class="">This would make it very easy to create new<span class="Apple-converted-space">&nbsp;</span><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); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">Point</code><span class="Apple-converted-space">&nbsp;</span>instances.</p><pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; white-space: pre-wrap; 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;" class=""><span style="color: rgb(51, 51, 51); font-weight: bold;" class="">let</span> somePoint: <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Point</span> = (<span style="color: rgb(0, 128, 128);" class="">50</span>, <span style="color: rgb(0, 128, 128);" class="">120</span>)
<span style="color: rgb(51, 51, 51); font-weight: bold;" class="">let</span> otherPoint = <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">Point</span>(x: <span style="color: rgb(0, 128, 128);" class="">50</span>, y: <span style="color: rgb(0, 128, 128);" class="">120</span>)
</code></pre><div title="MDH:V2hlbiB3b3JraW5nIHdpdGggcG9pbnRzLCBJJ2xsIHNvbWV0aW1lcyBtYWtlIGEgYHR5cGVhbGlh
c2AgdG8gYW4gaW50ZWdlciB0dXBsZTo8ZGl2PmBgYHN3aWZ0PC9kaXY+PGRpdj50eXBlYWxpYXMg
UG9pbnQgPSAoeDogSW50LCB5OiBJbnQpPC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2Pjxicj48L2Rp
dj48ZGl2Pkhvd2V2ZXIsIGlmIEkgd2FudCB0byBhZGQgZXh0ZW5kZWQgZnVuY3Rpb25hbGl0eSB0
byBteSBgUG9pbnRgIHR5cGUsIEkgd291bGQgaGF2ZSB0byBjaGFuZ2UgaXQgdG8gYSBgc3RydWN0
YCwgcmVtb3ZpbmcgdGhlIGFiaWxpdHkgdG8gY3JlYXRlIG9uZSBvbiB0aGUgZmx5IHdpdGggYSB0
dXBsZS48L2Rpdj48ZGl2Pjxicj48L2Rpdj48ZGl2PkknbSBwcm9wb3NpbmcgYSBgVHVwbGVDb252
ZXJ0aWJsZWAgcHJvdG9jb2wgdGhhdCBhbGxvd3MgaW5pdGlhbGl6YXRpb24gZnJvbSBhIHR1cGxl
IGRpcmVjdGx5LjwvZGl2PjxkaXY+PGRpdj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; max-width: 0px; overflow: hidden; font-size: 0em; padding: 0px; margin: 0px;" class=""></div></div></div></div></blockquote></div></div></div></div><div style="word-wrap: break-word;" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=5xu02FVv-2BCbxTLHpBsC0RVeXVC5uCln3pUIIeLTlIi3PNiwjZYG5DrLQWjxWyWV-2BHZxHS9coVxT4qg5XZrpnNkEtnUT1mw0mvnRMOOTtSkNEyelVeO8g4QkcRBcH2SEIr8NkH1VtgOTh-2FfPB3JM6WVYR-2Fbw56PRxDfLy6N0w7-2BAlxHGRf1GxjRTWsa8xw-2Fb4onLWQZ7E-2BvKGlf8eEaeNItqmQ6kz-2BonpL9JbecuUaQ0-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div></div></div></div></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=hWKWvOREWCPT32eVzNXOV7yIWXgGOvlMtgjKbOieJnbynZhIfKgfI0wGokYSOOHaUYaYGpuMNFU8RC7wDOoxHGH-2BMfisiEbh-2FGwDRijp-2BlSMmcOhXoPNVza-2BOq-2FS9ejOeKcCC1bAQMvse3pPR8jMtOeRUHHbB-2BWgIcCG046d-2FbuG-2B5ylFcNNcrKRIfPckkWa2-2Bb7-2F0uJq5zSCV51h3PRifmcrcnewHNlTnHjfHrshbc-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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 class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: 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: 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: 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="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: 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: 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="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>