<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="">My array proposals included some form of specifying storage ranks for each extent. By default, the ranks would follow row-major order, like C. The first dimension would have the widest span between elements that differ by 1 in the first index and are the same for other indexes. The last dimension would have elements that differ by 1 in the last index and are the same for other indexes be adjacent in memory.</div><div class=""><br class=""></div><div class="">Overriding the ranks would change the numbers in the offset vector, which is combined with the index vector via the dot product to determine the memory offset of the desired element. The most common use for this is specifying column-major order, like Fortran. But recently I realized that I may have been too theoretical; Fortran-compatibility isn’t the most common use, but the only use. Is there any application for arbitrary storage ranks? (For N extents, there are N! possible storage ranks.) I’ve never heard of any other orders besides row- and column-majors.</div><div class=""><br class=""></div><div class="">You can implement column-major array indexing by reversing the order of indexes before dereference. This means if static-sized arrays get added to Swift, and value-based generic parameters and variadic generic parameters also get added, then a column-major array could be implemented as a library type. I think I’ll go with that, unless there’s a pressing need for column-major or arbitrary-ranked arrays out there.</div><div class=""><br class=""></div><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; 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=""></body></html>