<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I'm going to start work on a proposal to treat them as the same type.</div><div><br>On 04 Feb 2016, at 19:57, Maximilian Hünenberger 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><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class="">Is there a reasoning behind treating (Int, Int) and (lhs: Int, rhs: Int) as separate types?</div><div class=""><br class=""></div><div class="">Should it be treated as the same type as the proposal suggests?</div><div class=""><br class=""></div><div class="">Is there a connection to your tuple splat proposal?</div><div class=""><br class=""></div><div class="">Thank you in advance for clarification :)</div><div class="">- Maximilian</div><br class=""><div><blockquote type="cite" class=""><div class="">Am 04.02.2016 um 18:27 schrieb Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 4, 2016, at 1:10 AM, David Hart 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Before I start working on a proposal, I’d like to understand the problem in detail. Can someone help me understand why parts of the language treats tuple labels as type and other not?<div class=""><div class=""><br class=""></div><div class=""><font face="Menlo" class="">let&nbsp;a: (lhs:&nbsp;Int, rhs:&nbsp;Int) = (4,&nbsp;5) // works</font></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">This is supposed to work because of an implicit conversion.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><font face="Menlo" class="">(4,5).dynamicType&nbsp;== (lhs:&nbsp;2, rhs:&nbsp;6).dynamicType // true</font></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">This is not supposed to behave this way. &nbsp;The bug here is that we’re not encoding tuple labels in the metadata record for tuples.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">But:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">[(lhs:&nbsp;3, rhs:&nbsp;5)] == [(1,2)]</font></div><div class=""><font face="Menlo" class="">// Binary operator ‘==‘ cannot be applied to operands of type ‘[(las: Int, rhs: Int)]’ and ‘[(Int, Int)]’</font></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">This is correctly rejected.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><font face="Menlo" class="">[(lhs:&nbsp;3, rhs:&nbsp;5)].dynamicType&nbsp;== [(1,2)].dynamicType</font></div><div class=""><font face="Menlo" class="">// Binary operator&nbsp;‘==‘ cannot be applied to operands of type&nbsp;‘Array&lt;(las: Int,&nbsp;rhs: Int)&gt;.Type’ and&nbsp;‘Array&lt;(Int, Int)&gt;’</font></div></div></div></div></blockquote><br class=""><div class="">This is correctly rejected.</div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">And:</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">struct&nbsp;Foo&lt;T&gt; {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>let&nbsp;bar:&nbsp;T<br class="">}<br class=""><br class="">var&nbsp;foo1 =&nbsp;Foo(bar: (4,&nbsp;5))<br class="">var&nbsp;foo2 =&nbsp;Foo(bar: (lhs:&nbsp;4, rhs:&nbsp;5))<br class="">foo1&nbsp;=&nbsp;foo2</font></div><div class=""><font face="Menlo" class="">// Cannot assign value of type ‘Foo&lt;(las: Int, res: Int)&gt;’ to type ‘Foo&lt;(Int, Int)&gt;’</font></div></div></div></div></blockquote><div class=""><br class=""></div>This is correctly rejected.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><font face="Menlo" class="">But:</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">foo1.dynamicType&nbsp;==&nbsp;foo2.dynamicType // true</font></div></div></div></div></blockquote><br class=""></div><div class="">Same problem: reflection metadata isn’t being encoded, so these end up looking like they have the same dynamic type, when they shouldn’t.</div><div class=""><br class=""></div><div class="">-Chris</div><br class=""></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">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></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>