<div dir="ltr"><div>Hi Swift Evolution populace,</div><div><br></div><div>I'd like a <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><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><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'">This proposal aims to make the minimal changes possible, with the most familiar syntax, and give tuples this power.</p><h3 style="margin-top:1em;margin-bottom:16px;line-height:1.43;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'"><span style="font-size:large">Examples</span><br></h3><div><font face="arial, helvetica, sans-serif">These are things that will be possible after these changes.</font></div><h4 style="margin-top:1em;margin-bottom:16px;line-height:1.4;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'">Joining two tuples together</h4><h4 style="margin-top:1em;margin-bottom:16px;line-height:1.4;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'"><div class="" style="margin-bottom:16px;font-weight:normal"><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 class="" style="color:rgb(167,29,93)">let</span> a <span class="" style="color:rgb(167,29,93)">=</span> (<span class="" style="color:rgb(0,134,179)">1</span>,<span class="" style="color:rgb(0,134,179)">2</span>), b <span class="" style="color:rgb(167,29,93)">=</span> (<span class="" style="color:rgb(0,134,179)">3</span>,<span class="" style="color:rgb(0,134,179)">4</span>)
<span class="" style="color:rgb(167,29,93)">let</span> c <span class="" style="color:rgb(167,29,93)">=</span> <span class="" style="color:rgb(0,134,179)">join</span>(a, b) <span class="" style="color:rgb(150,152,150)">// (Int,Int,Int,Int)</span></pre></div></h4><h4 style="margin-top:1em;margin-bottom:16px;line-height:1.4;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'">Stack like operations on tuples</h4><div class="" 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 class="" style="color:rgb(167,29,93)">let</span> (abcde) <span class="" style="color:rgb(167,29,93)">=</span> (<span class="" style="color:rgb(0,134,179)">1</span>,<span class="" style="color:rgb(0,134,179)">2</span>,<span class="" style="color:rgb(0,134,179)">3</span>,<span class="" style="color:rgb(0,134,179)">4</span>,<span class="" style="color:rgb(0,134,179)">5</span>)
<span class="" style="color:rgb(167,29,93)">let</span> (abcd,e) <span class="" style="color:rgb(167,29,93)">=</span> pop(abcde)
<span class="" style="color:rgb(167,29,93)">let</span> (abc,d) <span class="" style="color:rgb(167,29,93)">=</span> pop(abcd)
<span class="" style="color:rgb(167,29,93)">let</span> (abce) <span class="" style="color:rgb(167,29,93)">=</span> push(abc, e)
<span class="" style="color:rgb(0,134,179)">assert</span>(abce <span class="" style="color:rgb(167,29,93)">==</span> (<span class="" style="color:rgb(0,134,179)">1</span>,<span class="" style="color:rgb(0,134,179)">2</span>,<span class="" style="color:rgb(0,134,179)">3</span>,<span class="" style="color:rgb(0,134,179)">5</span>))</pre></div><h4 style="margin-top:1em;margin-bottom:16px;line-height:1.4;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'">Chained ZipSequence</h4><div><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;color:rgb(51,51,51)"><span class="" style="color:rgb(167,29,93)">let</span> a <span class="" style="color:rgb(167,29,93)">=</span> [<span class="" style="color:rgb(0,134,179)">1</span>,<span class="" style="color:rgb(0,134,179)">2</span>,<span class="" style="color:rgb(0,134,179)">3</span>]
<span class="" style="color:rgb(167,29,93)">let</span> b <span class="" style="color:rgb(167,29,93)">=</span> [<span class="" style="color:rgb(24,54,145)"><span class="" style="">"</span>a<span class="" style="">"</span></span>, <span class="" style="color:rgb(24,54,145)"><span class="" style="">"</span>b<span class="" style="">"</span></span>, <span class="" style="color:rgb(24,54,145)"><span class="" style="">"</span>c<span class="" style="">"</span></span>]
<span class="" style="color:rgb(167,29,93)">let</span> c <span class="" style="color:rgb(167,29,93)">=</span> [<span class="" style="color:rgb(0,134,179)">1</span><span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">2</span>, <span class="" style="color:rgb(0,134,179)">2</span><span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">3</span>, <span class="" style="color:rgb(0,134,179)">3</span><span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">4</span>]
<span class="" style="color:rgb(167,29,93)">let</span> d <span class="" style="color:rgb(167,29,93)">=</span> [<span class="" style="color:rgb(0,134,179)">nil</span>, <span class="" style="color:rgb(0,134,179)">nil</span>, <span class="" style="color:rgb(0,134,179)">123</span>]
<span class="" style="color:rgb(167,29,93)">let</span> abc <span class="" style="color:rgb(167,29,93)">=</span> a<span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">zip</span>(b)<span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">zip</span>(c)<span class="" style="color:rgb(167,29,93)">.</span><span class="" style="color:rgb(0,134,179)">zip</span>(d) <span class="" style="color:rgb(150,152,150)">// AnySequence<(Int,String,Float,Int?)></span></pre></div><h4 style="margin-top:1em;margin-bottom:16px;line-height:1.4;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'">Turn any function with a callback into one with a promise</h4><div class="" 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 class="" style="color:rgb(167,29,93)">func</span> <span class="" style="color:rgb(121,93,163)">promise</span><A,B,C>(f: (A <span class="" style="color:rgb(167,29,93)">+</span> (B<span class="" style="color:rgb(167,29,93)">-></span><span class="" style="color:rgb(0,134,179)">Void</span>)) <span class="" style="color:rgb(167,29,93)">-></span> C) -> A -> (C, Promise<B>)</pre></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'"><span style="color:rgb(34,34,34);font-family:arial,sans-serif">This proposal, and more examples, can be seen in more detail here:</span><br></p><div> <a href="https://github.com/therealbnut/swift-evolution/blob/therealbnut-tuple-manipulation/proposals/0000-tuple-operators.md" target="_blank">https://github.com/therealbnut/swift-evolution/blob/therealbnut-tuple-manipulation/proposals/0000-tuple-operators.md</a><br></div><div><br></div><div>I'll keep this file up to date over the course of the discussion, PRs are welcome.</div></div><div><br></div><div><b>Related proposals:</b><br></div><div><br></div><div>This proposal's use cases relate to at least a few other currently active proposals:</div><div><ul><li><b>Compile-time parameters</b><br></li><ul><li><b><a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/5240" target="_blank">http://thread.gmane.org/gmane.comp.lang.swift.evolution/5240</a></b></li></ul><li><b>Contiguous Variables (A.K.A. Fixed Sized Array Type)</b></li><ul><li><b><a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/4809" target="_blank">http://thread.gmane.org/gmane.comp.lang.swift.evolution/4809</a><br></b></li></ul><li><b>Remove implicit tuple splat behavior from function applications<br></b></li><ul><li><b><a href="http://thread.gmane.org/gmane.comp.lang.swift.evolution/4681" target="_blank">http://thread.gmane.org/gmane.comp.lang.swift.evolution/4681</a></b></li></ul></ul></div><div>Thanks!</div></div>