title | parent |
---|---|
Definite Array Expression |
Constructors.md |
definite_array_expr ::= '[' (expr ',')* ']'
| '[' expr ',' '..' literal ']'
The last comma in the first case is optinal.
- The expression
[e_1, ..., e_n]
has type[T * n]
if alle_i
are of typeT
. - The expression
[e, .. n]
has type[T * n]
if alle_i
are of typeT
.n
must be a constant.
- All elements are evaluated from left to right and packed into a [[Definite Array]].
- The expression is evaluated and
n
-times duplicated in order to be packed into a [[Definite Array]].
let a = [1, 2, 3];
let b = [[1, 2], [3, 4]];
let c = [23, .. 4];