Definite Array Expression
Contents
Syntax
definite_array_expr ::= '[' (expr ',')* ']'
| '[' expr ',' '..' literal ']'
The last comma in the first case is optinal.
Typing
- The expression
[e_1, ..., e_n]has type[T * n]if alle_iare of typeT. - The expression
[e, .. n]has type[T * n]if alle_iare of typeT.nmust be a constant.
Semantics
- 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]].
Examples
let a = [1, 2, 3];
let b = [[1, 2], [3, 4]];
let c = [23, .. 4];