<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">Tuple is not designed to be used as commonly as classes and structs.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default"><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"><font face="georgia, serif">NOTE</font><font face="georgia, serif"><br></font><font face="georgia, serif">Tuples are useful for temporary groups of related values. They are not suited to the creation of complex data structures. If your data structure is likely to persist beyond a temporary scope, model it as a class or structure, rather than as a tuple. For more information, see Classes and Structures.</font></blockquote><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"> </blockquote><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">quoting from: <a href="https://developer.apple.com/library/prerelease/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html">https://developer.apple.com/library/prerelease/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html</a> </blockquote><div><br></div><div>If you looking up in the documents, there is no struct nor class called Tuple. The normal using on tuple in my option is to returning multiple values in a function, or switch-case matching.</div><div><br></div><div>So you are right, tuple is not well-formed. But it is designed to be used only temporarily. Please feel free to file another bug.</div><div><br></div><div>Zhaoxin</div><div> </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 6, 2016 at 1:48 PM, Aaron Bohannon via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Yesterday, it was pointed out that a variable name referring to a tuple cannot be used as a pattern.  I have noticed another sort of inconsistency in how tuples are treated when they are referenced by name:</div><div><br></div><div><div><font face="monospace, monospace">func f() -&gt; Int { return 5 }</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">let t = (&quot;a&quot;, f)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">let _: (String, () throws -&gt; Int) = t  // type error</font></div><div><font face="monospace, monospace">let _: (String, () throws -&gt; Int) = (t.0, t.1)  // OK</font></div></div><div><br></div><div>This situation leads to a different sort of type error; however, the error seems equally unwarranted.  I can&#39;t see any good reason for a well-typed program to become ill-typed when `(t.0, t.1)` is replaced with `t` (assuming `t` is a pair).</div><div><br></div><div>Should I file a separate bug for the specific example above?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Aaron</div></font></span></div>
<br>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>