<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">"|" denotes bitwise-OR. Not necessarily a great choice.<div class=""><br class=""></div><div class="">-Patrick</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 7, 2016, at 1:41 PM, David Sweeris <<a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Yeah, that's better than "+" or "&". What about "|"?<br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Feb 7, 2016, at 08:12, Patrick Gili via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">What about using << to denote concatenation? Many languages use this operator to denote "append", which is essentially concatenate.<div class=""><br class=""></div><div class="">-Patrick</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 6, 2016, at 5:41 PM, Andrew Bennett 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=""><div dir="ltr" class="">Thanks Tino, it would be good to come up with some alternatives for +.<div class=""><br class=""></div><div class="">I was initially thinking `<font face="monospace, monospace" class="">(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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">For some more examples have a look at the linked proposal :)</div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Jan 31, 2016 at 11:28 PM, Tino Heth <span dir="ltr" class=""><<a href="mailto:2th@gmx.de" target="_blank" class="">2th@gmx.de</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">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'" class="">a way to concatenate tuple types together:</span><br class=""></div><div class=""><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'" class=""><br class=""></span></div><div class=""><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'" class=""><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" class=""><span style="color:rgb(167,29,93)" class="">typealias</span> ABCD <span style="color:rgb(167,29,93)" class="">=</span> (A,B)<span style="color:rgb(167,29,93)" class="">+</span>(C,D) <span style="color:rgb(150,152,150)" class="">// Same as (A,B,C,D)</span></pre></div></div></div></div></blockquote></span><div class="">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 class="">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 class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><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'" class="">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'" class=""><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" class="">(a,(b,c),d) <span style="color:rgb(167,29,93)" class="">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 class=""><br class=""></div><div class="">That leads me to an unrelated thought:</div><div class="">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 & 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" class=""><div class=""><br class=""></div><div class="">Tino</div></font></span></div></blockquote></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" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></body></html>