<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 Feb 4, 2016, at 1:10 AM, David Hart via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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 a: (lhs: Int, rhs: Int) = (4, 5) // works</font></div></div></div></div></blockquote><div><br class=""></div><div>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 == (lhs: 2, rhs: 6).dynamicType // true</font></div></div></div></div></blockquote><div><br class=""></div><div>This is not supposed to behave this way. 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: 3, rhs: 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><br class=""></div><div>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: 3, rhs: 5)].dynamicType == [(1,2)].dynamicType</font></div><div class=""><font face="Menlo" class="">// Binary operator ‘==‘ cannot be applied to operands of type ‘Array<(las: Int, rhs: Int)>.Type’ and ‘Array<(Int, Int)>’</font></div></div></div></div></blockquote><br class=""><div>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 Foo<T> {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>let bar: T<br class="">}<br class=""><br class="">var foo1 = Foo(bar: (4, 5))<br class="">var foo2 = Foo(bar: (lhs: 4, rhs: 5))<br class="">foo1 = foo2</font></div><div class=""><font face="Menlo" class="">// Cannot assign value of type ‘Foo<(las: Int, res: Int)>’ to type ‘Foo<(Int, Int)>’</font></div></div></div></div></blockquote><div><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 == 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=""></body></html>