Contents Up << >>

Aggregate expressions

The primary of an expression can, among other things, be an aggregate expression. An aggregate expression is used to build an object of a composite type from objects of the elements' types of the composite type. For example, the aggregate (0,false,false,X"0000") could be used to build an object of the cache_element type we saw earlier The resulting composite type of the aggregate expression must be determinable by the types of the elements. This means the composite type must be a type that you have defined. If the cache_element type had not been declared (or any other type like it) then the aggregate (0,false,false,X"0000") would result in an error.

The syntax for the aggregate expression follows the rule: The example of the cache_element type aggregate uses positional association because the choices part does not appear and the values in the aggregate will be associated with the fields of the type in the same position. The choices part can be used in the following ways to make equivalent aggregates to the cache_element example: For array types, the choices part is used to specify an index or index range.