<div dir="ltr"><div><br></div><div><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex;color:rgb(117,117,117)"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">On Jan 7, 2017, at 23:37, Derrick Ho &lt;<a href="mailto:wh1pch81n@gmail.com" class="gmail_msg" target="_blank">wh1pch81n@gmail.com</a>&gt; wrote:</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">I think pattern matching is the most compelling reason to keep tuples.  </span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">If they were gone, how would we replace the following?</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">switch (a, b) {</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">case (value1, value2):</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">case (value3, value4):</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class="gmail_msg">}</span><br class="gmail_msg"></blockquote><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg">I really have to ask.  What do you use this for?  In general iPhone application programming I have never wanted or needed to do that.  I do some AudioUnits as well.  Still never needed it.</span><br class="gmail_msg"></div></blockquote></div><div><div class="gmail_msg"><span class="gmail_msg"><br></span></div></div><div class="gmail_msg">The alternative would be something like this</div><div class="gmail_msg">```</div><div class="gmail_msg">if a == value1 &amp;&amp; b == value2 {</div><div class="gmail_msg">} else if a == value3 &amp;&amp; b == value4 {</div><div class="gmail_msg">}</div><div class="gmail_msg">```</div><div class="gmail_msg"><br></div><div class="gmail_msg">You would end up repeating boilerplate code.  Plus, the switch statements guarantee that all cases are exhaustive while using a bunch of if-statements would not.  A switch statement would force you to provide a default case if you did not cover all the cases, but an if-statement doesn&#39;t stop you.</div><div class="gmail_msg"><br></div><div class="gmail_msg">Exhaustive switch statements are popular among low-level C programming people that work with micro-controllers like Arduino.  I believe one of swifts goals is to enter that territory.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 8, 2017 at 1:49 PM David Sweeris &lt;<a href="mailto:davesweeris@mac.com">davesweeris@mac.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">On Jan 8, 2017, at 09:33, Freak Show &lt;<a href="mailto:freakshow42@mac.com" class="gmail_msg" target="_blank">freakshow42@mac.com</a>&gt; wrote:<br class="gmail_msg"><br class="gmail_msg"></div><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">On Jan 7, 2017, at 22:51, David Sweeris &lt;<a href="mailto:davesweeris@mac.com" class="gmail_msg" target="_blank">davesweeris@mac.com</a>&gt; wrote:</span><br class="gmail_msg"></blockquote><span class="gmail_msg"></span><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">A really convenient way to pass around multiple values without having to bother with a formal struct.</span><br class="gmail_msg"></blockquote><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg">That&#39;s actually a big part of my concern.</span><br class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg">The people on this list are, I&#39;m certain, among the top programmers working.</span><br class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg">I&#39;m more worried about what happens when average (which IME means barely competent) developers get going with this.  I suspect nobody will ever declare a struct again.</span></div></blockquote><br class="gmail_msg"></div><div dir="auto" class="gmail_msg"><div class="gmail_msg">Doubtful, since tuples can&#39;t have any computed properties, functions, or conform to protocols.</div></div><div dir="auto" class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg">Type declarations are valuable - they are an opportunity to express intent.  OTOH, a pair of ints is a pair of ints and if all pairs of ints are type compatible then opportunities for catching errors drop if developers start favoring anonymous tuples over former structs.</span><br class="gmail_msg"></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div><div dir="auto" class="gmail_msg"><div class="gmail_msg">I don&#39;t think they are... &quot;(Int, Int)&quot; (without labels) will type-check to any pair of Ints, but IIRC &quot;(x:Int, y:Int)&quot; won&#39;t type-check to &quot;(a:Int, b:Int)&quot;.</div></div><div dir="auto" class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><span class="gmail_msg"></span><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">On Jan 7, 2017, at 23:37, Derrick Ho &lt;<a href="mailto:wh1pch81n@gmail.com" class="gmail_msg" target="_blank">wh1pch81n@gmail.com</a>&gt; wrote:</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">I think pattern matching is the most compelling reason to keep tuples.  </span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">If they were gone, how would we replace the following?</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">switch (a, b) {</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">case (value1, value2):</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">case (value3, value4):</span><br class="gmail_msg"></blockquote><blockquote type="cite" class="gmail_msg"><span class="gmail_msg">}</span><br class="gmail_msg"></blockquote><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg"></span><br class="gmail_msg"><span class="gmail_msg">I really have to ask.  What do you use this for?  In general iPhone application programming I have never wanted or needed to do that.  I do some AudioUnits as well.  Still never needed it.</span><br class="gmail_msg"></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div><div dir="auto" class="gmail_msg"><div class="gmail_msg">&quot;Need&quot; is a strong word... Yeah, I <i class="gmail_msg">could</i> switch over the first value and then for <i class="gmail_msg">every single case</i> nest another switch over the second value, but that&#39;d be annoying <i class="gmail_msg">and</i> obscure the underlying logic.</div><br class="gmail_msg"><div class="gmail_msg">- Dave Sweeris</div></div></blockquote></div>