Construction
The construction postfix operation constructs a new value of a structure or enumeration type from its arguments.
Process
At runtime:
- the arguments are evaluated, left to right; and
- a value of the operand's structure type, or of the enumeration type of the referenced enumeration variant, is constructed from them.
Assertions
- The operand is either:
- a value of the type type denoting a structure type; or
- a reference to an enumeration variant, qualified through the enumeration's lookup scope.
- Structure construction arguments are positional: there is exactly one argument per declared field, in declared order.
- An enumeration construction has exactly one argument, the referenced variant's declared payload value; a variant with no declared payload has zero arguments.
- Each argument has the type of its corresponding field or payload, and its expected type is that type.
Syntax
construction_operation = left_brace, [ expression, { comma, expression } ], right_brace ;