(component_association {, component_association})
component_association ::=
[choice {| choice} => ] expression
others
), but if both positional and named associations are used in the same aggregate, then positional associations must occur first, at their normal position. Hence once a named association is used, the rest of the aggregate must use only named associations. Aggregates containing a single component association must always be given in named notation. Specific rules concerning component associations exist for record aggregates and array aggregates.
others
is only allowed in a component association if the association appears last and has this single choice; it specifies all remaining components, if any.
others
is given as a choice of a record aggregate, it must represent at least one component. A component association with the choice others
or with more than one choice is only allowed if the represented components are all of the same type. The expression of a component association must have the type of the associated record components.
(DAY => 4, MONTH => JULY, YEAR => 1776)
(MONTH => JULY, DAY => 4, YEAR => 1776)
(UNIT => DISK, STATUS => CLOSED, CYLINDER => 9, TRACK => 1)
(VALUE => 0, SUCC|PRED => new
CELL'(0, null
, null
)) -- see 3.8.1
-- The allocator is evaluated twice: SUCC and PRED designate
-- different cells
others
, the rest (if any) of the component associations of an array aggregate must be either all positional or all named. A named association of an array aggregate is only allowed to have a choice that is not static, or likewise a choice that is a null range, if the aggregate includes a single component association and this component association has a single choice. An others
choice is static if the applicable index constraint is static.
others
choice are determined by the applicable index constraint. An others
choice is only allowed if the aggregate appears in one of the following contexts (which defines the applicable index constraint):
others
choice, named associations are allowed for other associations only in the case of a (nongeneric) actual parameter or function result. If the aggregate is a multidimensional array, this restriction also applies to each of its subaggregates.
others
choice are determined as follows. For an aggregate that has named associations, the bounds are determined by the smallest and largest choices given. For a positional aggregate, the lower bound is determined by the applicable index constraint if the aggregate appears in one of the contexts (a) through (c); otherwise, the lower bound is given by S'FIRST where S is the index subtype; in either case, the upper bound is determined by the number of components.
others
choice are such that the bounds of such an aggregate are always known from the context.
(7, 9, 5, 1, 3, 2, 4, 8, 6, 0)
TABLE'(5, 8, 4, 1, others
=> 0) -- see 3.6
(1 .. 5 => (1 .. 8 => 0.0)) -- two-dimensional
(1 .. N => new
CELL) -- N new cells, in
-- particular for N = 0
others
=> 0)
SCHEDULE'(MON .. FRI => TRUE, others
=> FALSE) -- see 3.6
SCHEDULE'(WED | SUN => FALSE, others
=> TRUE)
-- Three aggregates for the same value of
-- type MATRIX (see 3.6):
((1.1, 1.2, 1.3), (2.1, 2.2, 2.3))
(1 => (1.1, 1.2, 1.3), 2 => (2.1, 2.2, 2.3))
(1 => (1 => 1.1, 2 => 1.2, 3 => 1.3), 2 =>
(1 => 2.1, 2 => 2.2, 3 => 2.3))
A : TABLE := (7, 9, 5, 1, 3, 2, 4, 8, 6, 0); -- A(1)=7, A(10)= 8
B : TABLE := TABLE'(2 | 4 | 10 => 1, others
=> 0); -- B(1)=0,
-- B(10)=1
C : constant
MATRIX := (1 .. 5 =>
(1 .. 8 => 0.0)); --C'FIRST(1)=1, C'LAST(2)=8
E : BIT_VECTOR(M .. N) := (others
=> TRUE);
F : STRING(1 .. 1) := (1 => `F'); -- a one component aggregate:
-- same as "F"