[top] [prev] [next]

Set, array, and record constructors

A set constructor has the form:

    S{e_1, ..., e_n}
where S is a set type and the e's are expressions or ranges of the form lo..hi. The constructor denotes a value of type S containing the listed values and the values in the listed ranges. The e's, lo's, and hi's must be assignable to the element type of S.

An array constructor has the form:

    A{e_1, ..., e_n}
where A is an array type and the e's are expressions. The constructor denotes a value of type A containing the listed elements in the listed order. The e's must be assignable to the element type of A. This means that if A is a multi-dimensional array, the e's must themselves be array-valued expressions.

If A is a fixed array type and n is at least 1, then e_n can be followed by ", .." to indicate that the value of e_n will be replicated as many times as necessary to fill out the array. It is a static error to provide too many or too few elements for a fixed array type.

A record constructor has the form:

    R{Bindings}
where R is a record type and Bindings is a list of keyword or positional bindings, exactly as in a procedure call. The list of bindings is rewritten to fit the list of fields and defaults of R, exactly as for a procedure call; the record field names play the role of the procedure formal parameters. The expression denotes a value of type R whose field values are specified by the rewritten binding.

The rewritten binding must bind only field names and must bind each field name exactly once. Each expression in the binding must be assignable to the type of the corresponding record field.

[top] [prev] [next]