<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="">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 class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 29, 2017, at 11:39 PM, Nicolas Fezans 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=""><div class=""><div class=""><br class=""><div class="gmail_quote"><div class="">On Mon 29. May 2017 at 20:57, David Sweeris via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
> On May 29, 2017, at 01:12, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class="">
><br class="">
> I agree strongly that the syntax looks awkward — imho<br class="">
> var v: Vector<Int, size: 3><br class="">
> would be a much better fit than<br class="">
> var v array 3 of Int<br class="">
><br class="">
> As much as I want to have "real" arrays, I don't think we should add new keywords for them.<br class="">
<br class="">
Yeah, a "fixed-size array" is probably the most obvious use-case for allowing literal values to be generic parameters. In fact, at that point, they'd just be another type... no special support needed, other than validating the count when assigning array literals to them.<br class="">
</blockquote><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
The syntax that gained some traction last time they were seriously discussed would also be better, IMHO:<br class="">
let x: [Int x 4]<br class="">
or maybe it was this?<br class="">
let x: [Int * 4]<br class="">
Either way, it's more concise, far easier to read (IMHO), and doesn't need new keyword(s).</blockquote><div class=""><br class=""></div><div class="">I have not followed all previous discussions on this (so sorry if it was already proposed and/or discussed) but from the point of view of the "standard mathematics writing", it seems to me that it should rather be [Int^4] .</div><div class=""><br class=""></div><div class="">Indeed the three dimensional space built by combining the set of real numbers R is noted R^3 or alternatively RxRxR (but for larger dimensions you certainly do not want this writing!)</div><div class=""><br class=""></div><div class="">Strictly speaking Int^4 would be mathematically speaking more correct but [Int^4] has the advantage of making clear that this is indeed an array.</div><div class=""><br class=""></div><div class="">There are many aspects in the initial proposal that certainly need a more expert eye than mine. I have one question though. It seems to me that the constant expressions as known as constexpr in C++11 would be allowed as well. Is that right? If yes, are there any differences in the proposal to what is allowed in C++11? </div><div class=""><br class=""></div><div class="">Nicolas</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">
<br class="">
- Dave Sweeris<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div></div></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=""></div></body></html>