<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>How about "&amp;"? That way you can still define:</div><div id="AppleMailSignature">func + (lhs: (Int, Int), rhs: (Int, Int)) -&gt; (Int, Int) {...}</div><div id="AppleMailSignature">Without either removing the ability to concatenate tuples, or having to annotate types all over the place to resolve the ambiguities. (I'd love to use a different operator for concatenating Arrays &amp; Strings, as well, but that's not what this thread is about)</div><div id="AppleMailSignature"><br>- Dave Sweeris</div><div><br>On Feb 6, 2016, at 14:41, Andrew Bennett 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><div dir="ltr">Thanks Tino, it would be good to come up with some alternatives for +.<div><br></div><div>I was initially thinking `<font face="monospace, monospace">(Int,Int) (Int,Int)</font>` without operators. However I think this could potentially be a mistake. I like + as it's familiar with array operators.</div><div><br></div><div>As for the prevalence of tuples in the language, every function and value in Swift has a tuple in it. The associated values in an enum are a tuple. They are everywhere.</div><div><br></div><div>For some more examples have a look at the linked proposal :)</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 31, 2016 at 11:28 PM, Tino Heth <span dir="ltr">&lt;<a href="mailto:2th@gmx.de" target="_blank">2th@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div><div dir="ltr"><div>I'd like a&nbsp;<span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'">a way to concatenate tuple types together:</span><br></div><div><span style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><br></span></div><div><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal"><span style="color:rgb(167,29,93)">typealias</span> ABCD <span style="color:rgb(167,29,93)">=</span> (A,B)<span style="color:rgb(167,29,93)">+</span>(C,D) <span style="color:rgb(150,152,150)">// Same as (A,B,C,D)</span></pre></div></div></div></div></blockquote></span><div>I don't like the use of "+" for concatenation, but giving more power to tuples would be neat… you just need to find examples with convincing motivation ;-)</div><div>Obviously, the value of tuple-operation increases with the prevalence of tuples in language and libraries, so I wouldn't be surprised if their importance rises in the future (and maybe we can think of nice ways to combine tuple-related ideas).</div><span class=""><br><blockquote type="cite"><div><div dir="ltr"><div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'">Also a way to allow tuples to be converted to other tuples that are the same when flattened:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal">(a,(b,c),d) <span style="color:rgb(167,29,93)">as</span> ((a,b),(c,d))</pre></div></div></div></div></blockquote></span></div>It would be cool if such a concept ("compiler, please check if those two types have a compatible memory-layout, and if that is the case, let me use them interchangeable when I tell you to do so) could be extended to structs — that could solve the problem of different implementations of fundamental types nicely.<div><br></div><div>That leads me to an unrelated thought:</div><div>It seems to me there is a duality between methods and closures on one side, and structs and tuples on the other — tuples feel very much like anonymous structs (restricted by the fact that you cannot add methods like custom getters &amp; setters). It's not related to you proposal, but I wonder if there are implications visible from this point of view...</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Tino</div></font></span></div></blockquote></div><br></div>
</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>