<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 <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> 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 <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</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 <<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 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 == (lhs: 2, rhs: 6).dynamicType // true</font></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">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 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: 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 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 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 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 == 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>