<html><head></head><body dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div class="AppleOriginalContents" style="direction: ltr;"><blockquote type="cite"><div>On May 29, 2017, at 3:37 AM, Rien <Rien@Balancingrock.nl> wrote:</div><br class="Apple-interchange-newline"><div><div>While I’d like a fixed size array, I’d agree with Rod that this looks odd.<br class=""><br class="">Myself I use the name ‘array’ a lot in places where I get/need a temporary array that lives for a few lines only. So I am against using the keyword ‘array’.<br class=""></div></div></blockquote><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">That’s why I hope “array” can be made a conditional keyword, for backward compatibility. Any other keyword, for this or any other proposal, will also have this problem.</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><blockquote type="cite"><div><div>A name like SizedArray would seem more in-line with other Swift types.<br class=""></div></div></blockquote><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">I originally was going to have fixed arrays be a “struct” with funny settings. After thinking on how I would define the shape directive and deal with any potential problems, I reconsidered and made fixed arrays be a separate kind of type. For example, enumerations are distinct kinds of types and not SwFS-es either (no matter how they’re internally implemented).</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><blockquote type="cite"><div><div>Also, there is a standard way of looking up indicies, and it uses the ‘[]’ signs. Why did you drop that?<br class="">I would expect confusion when looking up a variable index like: let c = x.myIndex<br class="">let c = x[myIndex] looks decidedly more clear to me.<br class=""></div></div></blockquote><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">Array-segment references (via “Collection”) and nominal arrays (in my list of default members) do support the subscript operator. Immediate arrays don’t, because they are supposed to model homogenous tuples, and tuples are generally closed to extensions.</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">You can’t use a variable index with an immediate array, just like you can’t with a tuple. (You can if you make an array-segment reference from the immediate array first.)</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><div class="AppleOriginalContents" style="direction: ltr;">Oh, I forgot to mention that you can use a “for”-loop with arrays. Iteration with immediate and nominal arrays work as if they were converted to an array-segment reference first. (But I think we should require an explicit conversion if you want to use “.enumerated()” or other “Collection” members, because the direct fixed array types don’t have those members.) I say “as if” so the implementors can be free to do unwrapping or any other optimizations having the elements on the stack can give.</div><div class="AppleOriginalContents" style="direction: ltr;"><br></div><blockquote type="cite"><div><div>Btw, what to think of:<br class=""><br class="">var z: array 2 of Array<array 5 of Double><br class=""><br class="">(that looks pretty horrible to me)<br class=""></div></div></blockquote></div><br><div>If you use nested arrays where some extents have to flexible and others are fixed, and you want the efficiencies from not using the heap for the fixed dimensions, this can’t be avoided.</div><div><br></div><div><div id="AppleMailSignature"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>— </div><div>Daryle Walker<br>Mac, Internet, and Video Game Junkie<br>darylew AT mac DOT com </div><div><br></div></div></div></div></body></html>