<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 30, 2017, at 2:32 AM, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:</div><br class="Apple-interchange-newline"><div><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="">Sorry if this has been suggested before, but what is wrong with something along<div class=""><br class=""></div><div class="">let x: Int[4]</div><div class="">let x: Int<4></div><div class=""><br class=""></div><div class="">In case of multi-dimension arrays:</div><div class=""><br class=""></div><div class="">let x: Int[4][4]</div><div class="">let x: Int[4, 4]</div><div class="">let x: Int<4><4></div><div class="">let x: Int<4, 4></div><div class=""><br class=""></div><div class="">I see small issues with each that would need to be discussed - the first would disallow subscripts on types. Subscripts currently cannot be static, at least now anyway, though. The second syntax is too close to generics, which may be confusing...</div></div></div></blockquote></div><br><div>I already mentioned that I do not want to use generics syntax.</div><div><br></div><div>For “Int[4]” or similar: we don’t use C’s (cute) “declaration looks like use” syntax. The declaration wouldn’t spiral out, but be strictly in one direction. That means that the bracketed part would array-ize the type expression to its left. That means that “Int[4][6]” would make the widest span the extent with six elements, the reverse direction of C’s array declarations. However, dereferencing still happens in C’s order. So now it’s double confusing, unless we break Swift’s philosophy and make nested array extent order to be the same as C. Or do what I did and make the extent length precede the element type.</div><div><br></div><div>I kept multiple-dimension support out of immediate arrays for similar reasons. Think about “Int[5, 6]”, does that store the elements like “Int[5][6]” or “Int[6][5]”? (And is that like C’s order or my theoretical Swift reversed order?) Instead of worrying about that in quick & dirty arrays, I moved said concerns to a full declaration block syntax for arrays, and even allow overriding of row-major vs. column-major. And the immediate arrays use tuple’s “object.index” for dereference; I would have to find a way to make that work with multiple coordinates, but not for nominal arrays which can use the subscript operator. (And no, I don’t support “[]” on immediate arrays, since they’re supposed to model tuples (with homogenous member type), which are generally closed for extensions.)</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>