<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=""><div class="">Yes, by nominal tuples I did mean a struct definition somewhere in swift’s standard library.</div><div class=""><br class=""></div><div class="">Seems like there are some quirks to tuples in Swift that I’m not aware of. I always assumed that they are packed ordinary structures. Since structure member offset is a compile-time constant, using tuples for arrays would not really be bad for performance, unless I’m missing something.</div><div class=""><br class=""></div><div class="">The C++ style compile-time wizardry is a subpar solution because it’s a hacky workaround due to lack of proper compile-time tools. If Swift would some day gain ability to execute imperative metaprogramming code that would manipulate the types at compile-time, all problems of this sort would be solved forever. But depending on how Swift compiler is implemented that may or may not be a monumental endeavor.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 13, 2017, at 7:27 AM, Daryle Walker <<a href="mailto:darylew@mac.com" class="">darylew@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 style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">— </div><div class="">Daryle Walker<br class="">Mac, Internet, and Video Game Junkie<br class="">darylew AT mac DOT com </div></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 12, 2017, at 4:30 PM, Gor Gyolchanyan <<a href="mailto:gor@gyolchanyan.com" class="">gor@gyolchanyan.com</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=""><div class="">I agree, given the current state of Swift, fixed-sized arrays are way too magical.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Any more “magical” than the existing primitive types?</div><div class=""><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="">I’d suggest postponing the idea of fixed-sized arrays (even though I myself have ached for them for a long time now) until its prerequisites are met.</div><div class=""><br class=""></div><div class="">There are three language features that have been discusses before that are required for this:</div><div class=""><ul class="MailOutline"><li class="">Variadic generic parameters.</li><li class="">Tuples as nominal types with a variadic generic parameter and a tuple concatenation ability.</li><li class="">Non-type generic parameters (probably, only compile-time value types).</li></ul></div></div></div></blockquote><div class=""><br class=""></div><div class="">Improved generics would synergize with fixed-size arrays, but are not a prerequisite.</div><div class=""><br class=""></div><div class="">Wouldn’t nominal tuples be structures? Not that it matters here since FSAs aren’t quirky tuples. (I mentioned in the proposal that no language that I know of does this; homogenous and heterogenous product types are always distinct kinds of types.)</div><div class=""><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="">In these terms, a fixed-sized array would be a type that takes an <font face="PT Mono" color="#009051" class="">Int</font> as a generic parameter and uses a variadic tuple for its storage. If C++ templates has taught us anything is that metaprogramming can be used for achieving fantastic compile-time wizardry, like converting a single integer generic parameter and a single generic type parameter to a generic homogeneous variadic type parameter (by using a recursively defined variadic parameter dummy type).</div></div></div></blockquote></div><br class=""><div class="">I thought Swift was to avoid that kind of wizardry. And unless you don’t want any of the optimizations array operations get, then the compiler has to analyze tuple types to trigger “array mode."</div></div></div></blockquote></div><br class=""></body></html>