<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 27, 2017, at 11:44 AM, Karl Wagner 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">So, 2 quick points:<br class=""><div class=""><br class=""></div><div class="">1) I have often wanted a shorthand for expressing long tuples; I definitely think that’s something worth bike-shedding, e.g. - <font face="Courier" class="">(String * 4, Int32 * 4)</font> or something</div></div></div></blockquote><div><br class=""></div>Why not define a struct, or a tuple consisting of two arrays?</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">2) Having a special non-growing array type which is called “array” and separate from <font face="Courier" class="">Array<T></font> is not such a good idea IMO. I would rather allow tuples to conform to protocols (see: <a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#extensions-of-structural-types" class="">https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#extensions-of-structural-types</a>).</div><div class=""><br class=""></div><div class="">If tuples could conform to protocols, we could say “any tuple of homogenous elements is a <font face="Courier" class="">Collection</font>”. There would be benefits for the standard library, too - <font face="Courier" class="">EmptyCollection<T></font> would disappear, replaced with the empty tuple <font face="Courier" class="">()</font>,</div></div></div></blockquote><div><br class=""></div>This sounds too clever.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""> as would <font face="Courier" class="">CollectionOfOne<T></font>, to be replaced by a single-element tuple <font face="Courier" class="">(T)</font>.</div></div></div></blockquote><div><br class=""></div><div>For what it’s worth, Swift doesn’t have single-element tuples. (T) is just sugar for the type T itself.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""> We would also be able to remove our limited-arity <font face="Courier" class="">==</font> overloads in favour of actual, honest-to-goodness <font face="Courier" class="">Equatable</font> conformance.</div></div></div></blockquote><div><br class=""></div>I like this idea though.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">- Karl</div><a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#extensions-of-structural-types" class=""></a></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>