Version 1.58 of ai12s/amd2xcon.txt
!comment This file contains Corrigendum conflicts for Amendment 3 (Ada 202x).
!comment Conflicts occur when multiple issues change the same
!comment paragraph of the standard.
!comment This file (and the reading of it in the program) would need to
!comment be changed for a new Corrigendum or Amendment.
!comment The paragraphs must be in sorted order!!
!corrigendum 1.1.3(17/3)
!AI-0179-1
!AI-0265-1
@dinsa
An implementation conforming to this International Standard may provide
additional aspects, attributes, library units, and pragmas. However, it shall
not provide any aspect, attribute, library unit, or pragma having the same
name as an aspect, attribute, library unit, or pragma (respectively) specified
in a Specialized Needs Annex unless the provided construct is either as
specified in the Specialized Needs Annex or is more limited in capability than
that required by the Annex. A program that attempts to use an unsupported
capability of an Annex shall either be identified by the implementation before
run time or shall raise an exception at run time.
@dinst
For an implementation that conforms to this Standard, the implementation of
a language-defined unit shall abide by all postconditions, type invariants,
and default initial conditions specified for the unit by this International
Standard (see 11.4.2).
!corrigendum 1.2(3/2)
!AI-0058-1
!AI-0224-1
@drepl
ISO/IEC 1539-1:2004, @i<Information technology @emdash Programming languages
@emdash Fortran @emdash Part 1: Base language>.
@dby
ISO/IEC 1539-1:2018, @i<Information technology @emdash Programming languages
@emdash Fortran @emdash Part 1: Base language>.
!corrigendum 2.1(4.1/3)
!AI-0004-1
!AI-0263-1
@drepl
The semantics of an Ada program whose text is not in Normalization Form KC
(as defined by Clause 21 of ISO/IEC 10646:2011) is implementation defined.
@dby
The semantics of an Ada program whose text is not in Normalization Form C
(as defined by Clause 21 of ISO/IEC 10646:2017) is implementation defined.
!corrigendum 2.2(9)
!AI-0125-3
!AI-0212-1
@drepl
& @ @ ' @ @ ( @ @ ) @ @ * @ @ + @ @ , @ @ @endash @ @ . @ @ / @ @ : @ @ ; @ @ < @ @ = @ @ @> @ @ |
@dby
& @ @ ' @ @ ( @ @ ) @ @ * @ @ + @ @ , @ @ @endash @ @ . @ @ / @ @ : @ @ ; @ @ < @ @ = @ @ @> @ @ @@ @ @ [ @ @ ] @ @ |
!corrigendum 2.3(4/3)
!AI-0004-1
!AI-0263-1
@dinsa
An @fa<identifier> shall not contain two consecutive characters in category
@fa<punctuation_connector>, or end with a character in that category.
@dinst
@s8<@i<Legality Rules>>
An identifier shall only contain characters that may be present in
Normalization Form KC (as defined by Clause 21 of ISO/IEC 10646:2017).
!corrigendum 3.1(6/3)
!AI-0061-1
!AI-0308-1
@drepl
Each of the following is defined to be a declaration: any @fa<basic_declaration>;
an @fa<enumeration_literal_specification>; a @fa<discriminant_specification>;
a @fa<component_declaration>; a @fa<loop_parameter_specification>;
an @fa<iterator_specification>; a @fa<parameter_specification>;
a @fa<subprogram_body>; an @fa<extended_return_object_declaration>;
an @fa<entry_declaration>; an @fa<entry_index_specification>;
a @fa<choice_parameter_specification>;
a @fa<generic_formal_parameter_declaration>.
@dby
Each of the following is defined to be a declaration: any @fa<basic_declaration>;
an @fa<enumeration_literal_specification>; a @fa<discriminant_specification>;
a @fa<component_declaration>; a @fa<defining_identifier> of an
@fa<iterated_component_association>;
a @fa<loop_parameter_specification>;
a @fa<defining_identifier> of a @fa<chunk_specification>;
an @fa<iterator_specification>;
a @fa<defining_identifier> of an @fa<iterator_parameter_specification>;
a @fa<parameter_specification>;
a @fa<subprogram_body>; an @fa<extended_return_object_declaration>;
an @fa<entry_declaration>; an @fa<entry_index_specification>;
a @fa<choice_parameter_specification>;
a @fa<generic_formal_parameter_declaration>.
!corrigendum 3.2.4(31/4)
!AI-0301-1
!AI-0333-1
@drepl
@xindent<On every subtype conversion, a check is performed that the operand
satisfies the predicates of the target subtype. This includes all
parameter passing, except for certain parameters passed by reference, which
are covered by the following rule: After normal completion and leaving of a
subprogram, for each @b<in out> or @b<out> parameter that is passed by reference,
a check is performed that the value of the parameter satisfies the predicates
of the subtype of the actual. For an object created by an @fa<object_declaration>
with no explicit initialization @fa<expression>, or by an uninitialized
@fa<allocator>, if any subcomponents have @fa<default_expression>s, a check
is performed that the value of the created object satisfies the predicates of
the nominal subtype.>
@dby
@xindent<On a subtype conversion, a check is performed that the operand
satisfies the predicates of the target subtype, unless it is a conversion for
an actual parameter of mode @b<out> (see 4.6). In addition, after normal
completion and leaving of a
subprogram, for each @b<in out> or @b<out> parameter that is passed by reference,
a check is performed that the value of the parameter satisfies the predicates
of the subtype of the actual. For an object created by an @fa<object_declaration>
with no explicit initialization @fa<expression>, or by an uninitialized
@fa<allocator>, if the types of any parts have specified Default_Value or
Default_Component_Value aspects, or any subcomponents have
@fa<default_expression>s, a check is performed that the value of the created
object satisfies the predicates of the nominal subtype.>
!corrigendum 3.3(6)
!AI-0061-1
!AI-0308-1
@dinsa
@xbullet<a loop parameter;>
@dinst
@xbullet<the index parameter of an @fa<iterated_component_association>;>
@xbullet<the chunk parameter of a @fa<chunk_specification>;>
!corrigendum 3.3(18.1/3)
!AI-0061-1
!AI-0308-1
@dinsa
@xbullet<a loop parameter unless specified to be a variable for a generalized loop (see 5.5.2);>
@dinst
@xbullet<the index parameter of an @fa<iterated_component_association>;>
@xbullet<the chunk parameter of a @fa<chunk_specification>;>
!corrigendum 3.3(23/3)
!AI-0191-1
!AI-0294-1
@drepl
At the place where a view of an object is defined, a @i<nominal subtype> is
associated with the view. The object's @i<actual subtype> (that is, its
subtype) can be more restrictive than the nominal subtype of the view; it
always is if the nominal subtype is an @i<indefinite subtype>. A subtype is
an indefinite subtype if it is an unconstrained array subtype, or if it has
unknown discriminants or unconstrained discriminants without defaults (see
3.7); otherwise, the subtype is a @i<definite> subtype (all elementary subtypes
are definite subtypes). A class-wide subtype is defined to have unknown
discriminants, and is therefore an indefinite subtype. An indefinite subtype
does not by itself provide enough information to create an object; an
additional @fa<constraint> or explicit initialization @fa<expression> is
necessary (see 3.3.1). A component cannot have an indefinite nominal subtype.
@dby
At the place where a view of an object is defined, a @i<nominal subtype> is
associated with the view. The @i<nominal type> of a view is the type
of the nominal subtype of the view. The object's @i<actual subtype> (that is, its
subtype) can be more restrictive than the nominal subtype of the view; it
always is more restrictive if the nominal subtype is an @i<indefinite
subtype>. A subtype is an indefinite subtype if it is an unconstrained array
subtype, or if it has unknown discriminants or unconstrained discriminants
without defaults (see 3.7); otherwise, the subtype is a @i<definite> subtype
(all elementary subtypes are definite subtypes). A class-wide subtype is
defined to have unknown discriminants, and is therefore an indefinite
subtype. An indefinite subtype does not by itself provide enough information
to create an object; an additional @fa<constraint> or explicit initialization
@fa<expression> is necessary (see 3.3.1). A component cannot have an
indefinite nominal subtype.
!corrigendum 3.3(23.7/3)
!AI-0226-1
!AI-0228-1
@dinsa
@xbullet<it is part of the object denoted by a @fa<function_call> or
@fa<aggregate>; or>
@dinst
@xbullet<it is a value conversion or @fa<qualified_expression> where the
operand denotes a view of a composite object that is known to be constrained; or>
!corrigendum 3.3.1(23/3)
!AI-0061-1
!AI-0308-1
@drepl
@xindent<@s9<8 As indicated above, a stand-alone object is an object declared
by an @fa<object_declaration>. Similar definitions apply to "stand-alone
constant" and "stand-alone variable." A subcomponent of an object is not a
stand-alone object, nor is an object that is created by an @fa<allocator>. An
object declared by a @fa<loop_parameter_specification>,
@fa<iterator_specification>,
@fa<parameter_specification>, @fa<entry_index_specification>,
@fa<choice_parameter_specification>, @fa<extended_return_statement>, or
a @fa<formal_object_declaration> of mode @b<in out> is
not considered a stand-alone object.>>
@dby
@xindent<@s9<8 As indicated above, a stand-alone object is an object declared
by an @fa<object_declaration>. Similar definitions apply to "stand-alone
constant" and "stand-alone variable." A subcomponent of an object is not a
stand-alone object, nor is an object that is created by an @fa<allocator>. An
object declared by a @fa<loop_parameter_specification>,
@fa<iterator_specification>, @fa<iterated_component_association>,
@fa<chunk_specification>,
@fa<parameter_specification>, @fa<entry_index_specification>,
@fa<choice_parameter_specification>, @fa<extended_return_statement>, or
a @fa<formal_object_declaration> of mode @b<in out> is
not considered a stand-alone object.>>
!corrigendum 3.5(55.1/4)
!AI-0020-1
!AI-0225-1
@ddel
For a @fa<prefix> X that denotes an object of a scalar type (after any
implicit dereference), the following attributes are defined:
!corrigendum 3.9(6/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Tags @b<is>
@b<pragma> Preelaborate(Tags);
@b<type> Tag @b<is private>;
@b<pragma> Preelaborable_Initialization(Tag);>
@dby
@xcode<@b<package> Ada.Tags
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<type> Tag @b<is private>;
@b<pragma> Preelaborable_Initialization(Tag);>
!corrigendum 3.9(18.2/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<generic>
@b<type> T (<@>) @b<is abstract tagged limited private>;
@b<type> Parameters (<@>) @b<is limited private>;
@b<with function> Constructor (Params : @b<not null access> Parameters)
@b<return> T @b<is abstract>;
@b<function> Ada.Tags.Generic_Dispatching_Constructor
(The_Tag : Tag;
Params : @b<not null access> Parameters) @b<return> T'Class
@b<with> Convention =@> Intrinsic;
@b<pragma> Preelaborate(Generic_Dispatching_Constructor);>
@dby
@xcode<@b<generic>
@b<type> T (<@>) @b<is abstract tagged limited private>;
@b<type> Parameters (<@>) @b<is limited private>;
@b<with function> Constructor (Params : @b<not null access> Parameters)
@b<return> T @b<is abstract>;
@b<function> Ada.Tags.Generic_Dispatching_Constructor
(The_Tag : Tag;
Params : @b<not null access> Parameters) @b<return> T'Class
@b<with> Preelaborate, Convention =@> Intrinsic,
Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum 3.10(9/3)
!AI-0228-1
!AI-0324-1
@drepl
A view of an object is defined to be @i<aliased> if it is defined by an
@fa<object_declaration>, @fa<component_definition>, @fa<parameter_specification>, or
@fa<extended_return_object_declaration>
with the reserved word @b<aliased>, or by a renaming of an aliased view. In addition,
the dereference of an access-to-object value denotes an aliased view, as does a view
conversion (see 4.6) of an aliased view. The current instance of an immutably
limited type (see 7.5) is defined to be aliased.
Finally, a formal parameter or generic formal object of a tagged type is
defined to be aliased. Aliased views are the ones that can be designated by
an access value.
@dby
A view of an object is defined to be @i<aliased> if it is defined by an
@fa<object_declaration>, @fa<component_definition>, @fa<parameter_specification>, or
@fa<extended_return_object_declaration>
with the reserved word @b<aliased>, or by a renaming of an aliased view. In addition,
the dereference of an access-to-object value denotes an aliased view, as does a view
conversion (see 4.6) of an aliased view. A @fa<qualified_expression> denotes an
aliased view when the operand denotes an aliased view. The current instance
of an immutably limited type (see 7.5) is defined to be aliased.
Finally, a formal parameter or generic formal object of a tagged type is
defined to be aliased. Aliased views are the ones that can be designated by
an access value.
!corrigendum 3.10.2(9.1/3)
!AI-0236-1
!AI-0292-1
@drepl
@xbullet<The accessibility level of a @fa<conditional_expression> is the
accessibility level of the evaluated @i<dependent_>@fa<expression>.>
@dby
@xbullet<The accessibility level of a @fa<conditional_expression> (see 4.5.7)
is the accessibility level of the evaluated @i<dependent_>@fa<expression>.>
@xbullet<The accessibility level of a @fa<declare_expression> (see 4.5.9) is
the accessibility level of the @i<body_>@fa<expression>.>
!corrigendum 3.10.2(10.5/3)
!AI-0345-1
!AI-0372-1
@drepl
If the call itself defines the result of a function to which one of the above
rules applies, these rules are applied recursively;
@dby
If the call itself defines the result of a function @i<F>, or has an
accessibility level that is tied to the result of such a function @i<F>,
then the master of the call is that of the master of the call invoking @i<F>;
!corrigendum 3.10.2(16.1/3)
!AI-0236-1
!AI-0317-1
@drepl
In the above rules, the operand of a view conversion, parenthesized expression or
@fa<qualified_expression> is considered to be used in a context if the view conversion,
parenthesized expression or @fa<qualified_expression> itself is used in that context.
Similarly, a @i<dependent_>@fa<expression> of a @fa<conditional_expression> is
considered to be used in a context if the @fa<conditional_expression> itself is
used in that context.
@dby
In the above rules, the operative constituents of a @fa<name> or @fa<expression> (see
4.4) are considered to be used in a given context if the enclosing @fa<name> or
@fa<expression> is used in that context.
!corrigendum 3.10.2(19.2/4)
!AI-0277-1
!AI-0324-1
!AI-0345-1
@ddel
@xbullet<Inside a return statement that applies to a function or generic
function @i<F>, or the return expression of an expression function @i<F>, when
determining whether the accessibility level of an explicitly
aliased parameter of @i<F> is statically deeper than the level of the
return object of @i<F>, the level of the return object is considered to
be the same as that of the level of the explicitly aliased
parameter; for statically comparing with the level of other
entities, an explicitly aliased parameter of @i<F> is considered to have
the accessibility level of the body of @i<F>.>
!corrigendum 4.1.4(6)
!AI-0242-1
!AI-0262-1
@drepl
In an @fa<attribute_reference>, if the @fa<attribute_designator> is for an
attribute defined for (at least some) objects of an access type, then the
@fa<prefix> is never interpreted as an @fa<implicit_dereference>; otherwise
(and for all @fa<range_attribute_reference>s), if the type of the @fa<name>
within the @fa<prefix> is of an access type, the @fa<prefix> is interpreted
as an @fa<implicit_dereference>. Similarly, if the @fa<attribute_designator>
is for an attribute defined for (at least some) functions, then the
@fa<prefix> is never interpreted as a parameterless @fa<function_call>;
otherwise (and for all @fa<range_attribute_reference>s), if the @fa<prefix>
consists of a @fa<name> that denotes a function, it is interpreted as a
parameterless @fa<function_call>.
@dby
In an @fa<attribute_reference> that is not a
@fa<reduction_attribute_reference>, if the @fa<attribute_designator> is for an
attribute defined for (at least some) objects of an access type, then the
@fa<prefix> is never interpreted as an @fa<implicit_dereference>; otherwise
(and for all @fa<range_attribute_reference>s and
@fa<reduction_attribute_reference>s), if there is a @fa<prefix> and the type
of the @fa<name>
within the @fa<prefix> is of an access type, the @fa<prefix> is interpreted
as an @fa<implicit_dereference>. Similarly, if the @fa<attribute_designator>
is for an attribute defined for (at least some) functions, then the
@fa<prefix> is never interpreted as a parameterless @fa<function_call>;
otherwise (and for all @fa<range_attribute_reference>s and
@fa<reduction_attribute_reference>s), if there is a @fa<prefix> and the
@fa<prefix> consists of a @fa<name> that denotes a function, it is
interpreted as a parameterless @fa<function_call>.
!corrigendum 4.2(4)
!AI-0325-1
!AI-0373-1
@drepl
The expected type for a @fa<primary> that is a @fa<string_literal> shall be
a single string type.
@dby
The expected type for a @fa<primary> that is a @fa<string_literal> shall be
a single string type or a type with a specified String_Literal aspect (see
4.2.1). In either case, the @fa<string_literal> is interpreted to be of its
expected type. If the expected type of an integer literal is a type with a
specified Integer_Literal aspect (see 4.2.1), the literal is interpreted to
be of its expected type; otherwise it is interpreted to be of type
@i<universal_integer>. If the expected type of a real literal is a type with
a specified Real_Literal aspect (see 4.2.1), it is interpreted to be of its
expected type; otherwise, it is interpreted to be of type @i<universal_real>.
!corrigendum 4.2(6)
!AI-0295-1
!AI-0325-1
@drepl
For each character of a @fa<string_literal> with a given
expected string type, there shall be a corresponding
@fa<defining_character_literal> of the component type of the expected
string type.
@dby
If the expected type for a string_literal is a string type, then
for each character of the @fa<string_literal> there shall be a
corresponding @fa<defining_character_literal> of the component type of
the expected string type.
!corrigendum 4.2(10)
!AI-0295-1
!AI-0325-1
@drepl
The evaluation of a @fa<string_literal> that is a @fa<primary>
yields an array value containing the value
of each character of the sequence of characters of the @fa<string_literal>,
as defined in 2.6. The bounds of this array value are determined
according to the rules for @fa<positional_array_aggregate>s (see 4.3.3),
except that for a null string literal, the upper bound is the
predecessor of the lower bound.
@dby
The evaluation of a @fa<string_literal> that is a @fa<primary> and has an
expected type that is a string type, yields an array value containing the value
of each character of the sequence of characters of the @fa<string_literal>,
as defined in 2.6. The bounds of this array value are determined
according to the rules for @fa<positional_array_aggregate>s (see 4.3.3),
except that for a null string literal, the upper bound is the
predecessor of the lower bound. In other cases, the effect of evaluating
a @fa<string_literal> is determined by the String_Literal aspect that applies
(see 4.2.1).
!corrigendum 4.2(11)
!AI-0295-1
!AI-0325-1
@drepl
For the evaluation of a @fa<string_literal> of type @i<T>, a check is made that
the value of each character of the @fa<string_literal> belongs to the
component subtype of @i<T>. For the evaluation of a null string literal, a check
is made that its lower bound is greater than the lower bound of the base
range of the index type. The exception Constraint_Error is raised if
either of these checks fails.
@dby
For the evaluation of a @fa<string_literal> of a string type @i<T>, a check
is made that the value of each character of the @fa<string_literal> belongs
to the component subtype of @i<T>. For the evaluation of a null string
literal of a string type, a check is made that its lower bound is greater than
the lower bound of the base range of the index type. The exception
Constraint_Error is raised if either of these checks fails.
!corrigendum 4.2.1(0)
!AI-0249-1
!AI-0295-1
!AI-0312-1
!AI-0325-1
!AI-0342-1
!AI-0373-1
@dinsc
Using one or more of the aspects defined below, a type may be specified
to allow the use of one or more kinds of literals as values of the type.
@s8<@i<Static Semantics>>
The following type-related operational aspects (collectively known as
@i<user-defined literal aspects>) may be specified for any type @i<T>:
@xhang<@xterm<Integer_Literal>
This aspect is specified by a @i<function_>@fa<name> that statically
denotes a function with a result type of @i<T> and one @b<in> parameter
that is of type String and is not explictly aliased.>
@xhang<@xterm<Real_Literal>
This aspect is specified by a @i<function_>@fa<name> that statically
denotes a function with a result type of @i<T> and one @b<in> parameter
that is of type String and is not explictly aliased.>
@xhang<@xterm<String_Literal>
This aspect is specified by a @i<function_>@fa<name> that statically
denotes a function with a result type of @i<T> and one @b<in> parameter
that is of type Wide_Wide_String and is not explictly aliased.>
User-defined literal aspects are inherited according to the rules given
in 13.1.
When a numeric literal is interpreted as a value of a non-numeric
type @i<T> or a @fa<string_literal> is interpreted a value of a type @i<T>
that is not a string type (see 4.2), it is equivalent to a call to the
subprogram denoted by the corresponding aspect of @i<T>: the
Integer_Literal aspect for an integer literal, the Real_Literal aspect
for a real literal, and the String_Literal aspect for a @fa<string_literal>.
The actual parameter of this notional call is a @fa<string_literal>
having the textual representation of the original (numeric or string)
literal.
Such a literal is said to be a @i<user-defined literal>.
@s8<@i<Legality Rules>>
The Integer_Literal or Real_Literal aspect shall not be specified for a
type @i<T> if the full view of @i<T> is a numeric type. The String_Literal
aspect shall not be specified for a type @i<T> if the full view of @i<T> is
a string type.
For a nonabstract type, the function directly specified for a user-defined
literal aspect shall not be abstract.
For a tagged type with a partial view, a user-defined literal aspect shall
not be directly specified on the full type.
If a nonabstract tagged type inherits any user-defined literal aspect, then
each inherited aspect shall be directly specified as a nonabstract function
for the type unless the inherited aspect denotes a nonabstract function and
the type is a null extension.
In addition to the places where Legality Rules normally apply
(see 12.3), these rules also apply in the private part of an instance of
a generic unit.
@s8<@i<Bounded (Run-Time) Errors>>
It is a bounded error if the evaluation of a literal that has an expected
type with a specified user-defined literal aspect propagates an exception.
Either Program_Error or the exception propagated by the evaluation is raised
at the point of use of the value
of the literal. If it is recognized prior to run time that evaluation
of such a literal will inevitably (if executed) result in such a
bounded error, then this may be reported as an error prior to run time.
@s8<@i<Examples>>
@xcode<@b<subtype> Roman_Character @b<is> Character
@b<with> Static_Predicate =@>
Roman_Character @b<in> 'I' | 'V' | 'X' | 'L' | 'C' | 'D' | 'M';>
@xcode<Max_Roman_Number : @b<constant> := 3_999; --@ft<@i< MMMCMXCIX>>>
@xcode<@b<type> Roman_Number @b<is range> 1 .. Max_Roman_Number
@b<with> String_Literal =@> To_Roman_Number;>
@xcode<@b<function> To_Roman_Number (S : String) @b<return> Roman_Number
@b<with> Pre =@> S'Length @> 0 @b<and then>
(@b<for all> Char @b<of> S =@> Char @b<in> Roman_Character);>
@xcode<@b<function> To_Roman_Number (S : String) @b<return> Roman_Number @b<is>
(@b<declare>
R : @b<constant array> (Integer @b<range> <@>) @b<of> Roman_Number :=
(@b<for> D @b<in> S'Range =@> Roman_Digit'Enum_Rep
(Roman_Digit'Value (''' & S(D) & '''))); --@ft<@i< See 3.5.2 and 13.4>>
@b<begin>
[@b<for> I @b<in> R'Range =@>
(@b<if> I < R'Last @b<and then> R(I) < R(I + 1) @b<then> -1 @b<else> 1) * R(I)]
'Reduce("+", 0)
);>
@xcode<X : Roman_Number := "III" "IV" "XII"; --@ft<@i< 144 (that is, CXLIV)>>>
!corrigendum 4.3(2)
!AI-0127-1
!AI-0212-1
@drepl
@xindent<@fa<aggregate>@fa<@ ::=@ >@fa<record_aggregate>@ |@ @fa<extension_aggregate>@ |@ @fa<array_aggregate>>
@dby
@xindent<@fa<aggregate>@fa<@ ::=@ >@hr
@ @ @ @ @fa<record_aggregate>@ |@ @fa<extension_aggregate>@ |@ @fa<array_aggregate>@hr
@ @ |@ @fa<delta_aggregate>@ |@ @fa<container_aggregate>>
!corrigendum 4.3(3/2)
!AI-0127-1
!AI-0212-1
!AI-0307-1
@drepl
The expected type for an @fa<aggregate> shall be a single array type, record
type, or record extension.
@dby
The expected type for an @fa<aggregate> shall be a single array type,
a single type with the Aggregate aspect specified, or a single
descendant of a record type or of a record extension.
!corrigendum 4.3.1(17/3)
!AI-0086-1
!AI-0127-1
@drepl
The value of a discriminant that governs a @fa<variant_part> @i<P> shall
be given by a static expression, unless @i<P> is nested within a
@fa<variant> @i<V> that is not selected by the discriminant value
governing the @fa<variant_part> enclosing @i<V>.
@dby
For a @fa<record_aggregate> or @fa<extension_aggregate>, if a
@fa<variant_part> @i<P> is nested within a @fa<variant> @i<V> that is not
selected by the discriminant value governing the @fa<variant_part> enclosing
@i<V>, then there is no restriction on the discriminant governing @i<P>.
Otherwise, the value of the discriminant that governs @i<P> shall be given by
a static expression, or by a nonstatic expression having a constrained static
nominal subtype. In this latter case of a nonstatic expression, there shall be
exactly one @fa<discrete_choice_list> of @i<P> that covers each value that
belongs to the nominal subtype and satisfies the predicates of the subtype,
and there shall be at least one such value.
!corrigendum 4.3.2(5.4/3)
!AI-0236-1
!AI-0317-1
@ddel
@xbullet<a @fa<conditional_expression> having at least one
@i<dependent_>@fa<expression> that would violate this rule.>
!corrigendum 4.3.3(3/2)
!AI-0212-1
!AI-0306-1
@drepl
@xindent<@fa<positional_array_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@fa<expression>,@ @fa<expression>@ {,@ @fa<expression>})@hr
@ @ |@ (@fa<expression>@ {,@ @fa<expression>},@ @b<others>@ =@>@ @fa<expression>)@hr
@ @ |@ (@fa<expression>@ {,@ @fa<expression>},@ @b<others>@ =@>@ <@>>
@dby
@xindent<@fa<positional_array_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@fa<expression>,@ @fa<expression>@ {,@ @fa<expression>})@hr
@ @ |@ (@fa<expression>@ {,@ @fa<expression>},@ @b<others>@ =@>@ @fa<expression>)@hr
@ @ |@ (@fa<expression>@ {,@ @fa<expression>},@ @b<others>@ =@>@ <@>)@hr
@ @ |@ '['@ @fa<expression>@ {,@ @fa<expression>}[,@ @b<others>@ =@>@ @fa<expression>]@ ']'@hr
@ @ |@ '['@ @fa<expression>@ {,@ @fa<expression>},@ @b<others>@ =@>@ <@>@ ']'>
@xindent<@fa<null_array_aggregate>@fa<@ ::=@ >'['@ ']'>
!corrigendum 4.3.3(4)
!AI-0127-1
!AI-0212-1
@drepl
@xindent<@fa<named_array_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@fa<array_component_association>@ {,@ @fa<array_component_association>})>
@dby
@xindent<@fa<named_array_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@fa<array_component_association_list>)@hr
@ @ |@ '['@ @fa<array_component_association_list>@ ']'>
@xindent<@fa<array_component_association_list>@fa<@ ::=@ >@hr
@ @ @ @ @fa<array_component_association>@ {,@ @fa<array_component_association>}>
!corrigendum 4.3.3(5/2)
!AI-0127-1
!AI-0212-1
@drepl
@xindent<@fa<array_component_association>@fa<@ ::=@ >@hr
@ @ @ @ @fa<discrete_choice_list>@ =@>@ @fa<expression>@hr
@ @ |@ @fa<discrete_choice_list>@ =@>@ <@>>
@dby
@xindent<@fa<array_component_association>@fa<@ ::=@ >@hr
@ @ @ @ @fa<discrete_choice_list>@ =@>@ @fa<expression>@hr
@ @ |@ @fa<discrete_choice_list> =@> <@>@hr
@ @ |@ @fa<iterated_component_association>>
@xindent<@fa<iterated_component_association>@fa<@ ::=@ >@hr
@ @ @ @ @b<for> @fa<defining_identifier>@ @b<in>@ @fa<discrete_choice_list>@ =@>@ @fa<expression>@hr
@ @ |@ @b<for> @fa<iterator_specification>@ =@>@ @fa<expression>>
!corrigendum 4.3.3(9)
!AI-0212-1
!AI-0306-1
@drepl
An @fa<array_aggregate> of an n-dimensional array type shall be written as
an n-dimensional @fa<array_aggregate>.
@dby
An @fa<array_aggregate> of an n-dimensional array type shall be written as
an n-dimensional @fa<array_aggregate>, or as a @fa<null_array_aggregate>.
!corrigendum 4.3.3(17/3)
!AI-0061-1
!AI-0127-1
!AI-0212-1
@drepl
The @fa<discrete_choice_list> of an @fa<array_component_association> is allowed to
have a @fa<discrete_choice> that is a nonstatic @fa<choice_expression> or that is a
@fa<subtype_indication> or @fa<range> that defines a nonstatic or null range, only
if it is the single @fa<discrete_choice> of its @fa<discrete_choice_list>, and there
is only one @fa<array_component_association> in the @fa<array_aggregate>.
@dby
The @fa<discrete_choice_list> of an @fa<array_component_association> (including
an @fa<iterated_component_association>) is allowed to
have a @fa<discrete_choice> that is a nonstatic @fa<choice_expression> or that is a
@fa<subtype_indication> or @fa<range> that defines a nonstatic or null range, only
if it is the single @fa<discrete_choice> of its @fa<discrete_choice_list>, and
either there is only one @fa<array_component_association> in the
enclosing @fa<array_component_association_list> or the enclosing @fa<aggregate> is
an @fa<array_delta_aggregate>, not an @fa<array_aggregate>.
Either all or none of the @fa<array_component_association>s of an
@fa<array_component_association_list> shall be @fa<iterated_component_association>s
with an @fa<iterator_specification>.
!corrigendum 4.3.3(21)
!AI-0212-1
!AI-0250-1
!AI-0327-1
@drepl
The evaluation of an @fa<array_aggregate> of a given array type proceeds in two
steps:
@dby
For an @fa<array_aggregate> that contains only
@fa<array_component_association>s that are
@fa<iterated_component_association>s with @fa<iterator_specification>s,
evaluation proceeds in two steps:
@xhang<@xterms<1.>Each @fa<iterator_specification> is elaborated (in an
arbitrary order) and an iteration is performed solely to determine a maximum
count for the number of values produced by the iteration; all of these counts are
combined to determine the overall length of the array, and
ultimately the limits on the bounds of the array (defined below);>
@xhang<@xterms<2.>A second iteration is performed for each of the
@fa<iterator_specification>s, in the order given in the @fa<aggregate>, and
for each value conditionally produced by the iteration (see 5.5 and 5.5.2),
the associated @fa<expression> is evaluated, its
value is converted to the component subtype of the array type, and used to
define the value of the next component of the array starting at the low bound
and proceeding sequentially toward the high bound. A check is made
that the second iteration results in an array length no greater than the
maximum determined by the first iteration; Constraint_Error is raised if this
check fails.>
The evaluation of any other @fa<array_aggregate> of a given
array type proceeds in two steps:
!corrigendum 4.3.3(23.1/4)
!AI-0061-1
!AI-0212-1
@dinsa
Each @fa<expression> in an
@fa<array_component_association> defines the value for the associated
component(s). For an @fa<array_component_association> with <@>, the associated
component(s) are initialized to the Default_Component_Value
of the array type if this aspect has been specified for the array type;
otherwise, they are initialized by default as for a stand-alone object of the
component subtype (see 3.3.1).
@dinst
During an evaluation of the @fa<expression> of an
@fa<iterated_component_association> with a @fa<discrete_choice_list>, the
value of the corresponding index parameter is that of the corresponding
index of the corresponding array component. During an evaluation of the
@fa<expression> of an @fa<iterated_component_association> with an
@fa<iterator_specification>, the value of the loop parameter
of the @fa<iterator_specification> is the value produced by the iteration
(as described in 5.5.2).
!corrigendum 4.3.3(26)
!AI-0212-1
!AI-0250-1
!AI-0306-1
@dinsa
@xbullet<For a @fa<positional_array_aggregate> (or equivalent
@fa<string_literal>) without an @b<others> choice, the lower bound is that
of the corresponding index range in the applicable index constraint, if
defined, or that of the corresponding index subtype, if not; in either case,
the upper bound is determined from the lower bound and the number of
@fa<expression>s (or the length of the @fa<string_literal>);>
@dinss
@xbullet<For a @fa<null_array_aggregate>, bounds for each dimension are
determined as for a @fa<positional_array_aggregate> without an @b<others>
choice that has no expressions for each dimension;>
@xbullet<For a @fa<named_array_aggregate> containing only
@fa<iterated_component_association>s with an @fa<iterator_specification>, the
lower bound is determined as for a @fa<positional_array_aggregate> without
an @b<others> choice, and the upper bound is determined from the lower
bound and the total number of values produced by the second set of
iterations;>
!corrigendum 4.3.3(31)
!AI-0212-1
!AI-0250-1
@dinsa
The exception Constraint_Error is raised if any of the above checks fail.
@dinst
@s8<@i<Implementation Permissions>>
When evaluating @fa<iterated_component_association>s for an
@fa<array_aggregate> that contains only @fa<iterated_component_association>s
with @fa<iterator_specification>s, the first step of evaluating an
@fa<iterated_component_association> can be omitted if the implementation can
determine the maximum number of values by some other means.
!corrigendum 4.3.3(32/3)
!AI-0061-1
!AI-0306-1
@drepl
@xindent<@s9<NOTES@hr
11 In an @fa<array_aggregate>, positional notation may only be used with two
or more @fa<expression>s; a single @fa<expression> in parentheses is
interpreted as a parenthesized expression. A @fa<named_array_aggregate>, such
as (1 =@> X), may be used to specify an array with a single component.>>
@dby
@xindent<@s9<NOTES@hr
11 In an @fa<array_aggregate> delimited by parentheses, positional notation may
only be used with two or more @fa<expression>s; a single @fa<expression> in
parentheses is interpreted as a parenthesized expression. An @fa<array_aggregate>
delimited by square brackets may be used to specify an array with a single
component.>>
@xindent<@s9<12 An index parameter is a constant object (see 3.3).>>
!corrigendum 4.3.3(43)
!AI-0061-1
!AI-0312-1
@dinsa
@xcode<D : Bit_Vector(M .. N) := (M .. N =@> True); --@ft<@i< see 3.6>>
E : Bit_Vector(M .. N) := (@b<others> =@> True);
F : String(1 .. 1) := (1 =@> 'F'); --@ft<@i< a one component aggregate: same as "F">>>
@dinst
@xcode<G : @b<constant> Matrix :=
(@b<for> I @b<in> 1 .. 4 =@>
(@b<for> J @b<in> 1 .. 4 =@>
(@b<if> I=J @b<then> 1.0 @b<else> 0.0))); --@ft<@i< Identity matrix>>>
@xcode<Empty_Matrix : @b<constant> Matrix := []; --@ft<@i< A matrix without elements>>>
!corrigendum 4.3.4(0)
!AI-0127-1
!AI-0212-1
!AI-0324-1
!AI-0379-1
!AI-0381-1
!AI-0386-1
@dinsc
Evaluating a (record or array) delta aggregate yields a composite value that
starts with a copy of another value of the same type and then assigns to some
(but typically not all) components of the copy.
@s8<@i<Syntax>>
@xindent<@fa<delta_aggregate>@fa<@ ::=@ >@fa<record_delta_aggregate>@ |@ @fa<array_delta_aggregate>>
@xindent<@fa<record_delta_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@i<base_>@fa<expression>@ @b<with delta>@ @fa<record_component_association_list>)>
@xindent<@fa<array_delta_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ (@i<base_>@fa<expression>@ @b<with delta>@ @fa<array_component_association_list>)@hr
@ @ |@ '['@ @i<base_>@fa<expression>@ @b<with delta>@ @fa<array_component_association_list>@ ']'>
@s8<@i<Name Resolution Rules>>
The expected type for a @fa<record_delta_aggregate> shall be a single
descendant of a record type or record extension.
The expected type for an @fa<array_delta_aggregate> shall be a single
array type.
The expected type for the @i<base_>@fa<expression> of any
@fa<delta_aggregate> is the type of the enclosing @fa<delta_aggregate>.
The Name Resolution Rules and Legality Rules for each
@fa<record_component_association> of a @fa<record_delta_aggregate> are as
defined in 4.3.1.
For an @fa<array_delta_aggregate>, the expected type for each
@fa<discrete_choice> in an @fa<array_component_association> is the index type
of the type of the @fa<delta_aggregate>.
The expected type of the @fa<expression> in an
@fa<array_component_association> is defined as for an
@fa<array_component_association> occurring within an @fa<array_aggregate> of
the type of the @fa<delta_aggregate>.
@s8<@i<Legality Rules>>
For an @fa<array_delta_aggregate>, the @fa<array_component_association> shall
not use the box symbol <@>, and the @fa<discrete_choice> shall not be @b<others>.
For an @fa<array_delta_aggregate>, the dimensionality of the type of the
@fa<delta_aggregate> shall be 1.
For an @fa<array_delta_aggregate>, the @i<base_>@fa<expression> and each
@fa<expression> in every @fa<array_component_association> shall be of a
nonlimited type.
@s8<@i<Dynamic Semantics>>
The evaluation of a @fa<delta_aggregate> begins with the evaluation of the
@i<base_>@fa<expression> of the @fa<delta_aggregate>; then that value is
used to create and initialize the anonymous object of the @fa<aggregate>. The
bounds of the anonymous object of an @fa<array_delta_aggregate> and the
discriminants (if any) of the anonymous object of a
@fa<record_delta_aggregate> are those of the @i<base_>@fa<expression>.
If a @fa<record_delta_aggregate> is of a specific tagged type, its tag is
that of the specific type; if it is of a class-wide type, its tag is that
of the @i<base_>@fa<expression>.
For a @fa<record_delta_aggregate>, for each component associated with each
@fa<record_component_association> (in an unspecified order):
@xbullet<if the associated component belongs to a @fa<variant>, a check is
made that the values of the discriminants are such that the anonymous object
has this component. The exception Constraint_Error is raised if this check
fails.>
@xbullet<the @fa<expression> of the @fa<record_component_association> is
evaluated, converted to the nominal subtype of the associated component,
and assigned to the component of the anonymous object.>
For an @fa<array_delta_aggregate>, for each @fa<discrete_choice> of each
@fa<array_component_association> (in the order given in the enclosing
@fa<discrete_choice_list> and @fa<array_component_association_list>,
respectively) the @fa<discrete_choice> is evaluated; for each represented
index value (in ascending order, if the @fa<discrete_choice> represents a
range):
@xbullet<the index value is converted to the index type of the array type.>
@xbullet<a check is made that the index value belongs to the index range of
the anonymous object of the @fa<aggregate>; Constraint_Error is raised if
this check fails.>
@xbullet<the component @fa<expression> is evaluated, converted to the array
component subtype, and assigned to the component of the anonymous
object identified by the index value.>
@s8<@i<Examples>>
Simple use in a postcondition:
@xcode<@b<procedure> Twelfth (D : @b<in out> Date) --@ft<@i< see 3.8 for type Date>>
@b<with> Post =@> D = (D'Old @b<with delta> Day =@> 12);>
@xcode<@b<procedure> The_Answer (V : @b<in out> Vector; A, B : @b<in> Integer) --@ft<@i< see 3.6 for type Vector>>
@b<with> Post =@> V = (V'Old @b<with delta> A .. B =@> 42.0, V'First =@> 0.0);>
The base expression can be nontrivial:
@xcode<New_Cell : Cell := (Min_Cell (Head) @b<with delta> Value =@> 42);
--@ft<@i< see 3.10.1 for Cell and Head; 6.1 for Min_Cell>>>
@xcode<A1 : Vector := ((0 =@> 1.0, 1 =@> 2.0, 2 =@> 3.0)
@b<with delta> Integer(Random * 2.0) =@> 14.2);
--@ft<@i< see 3.6 for declaration of type Vector>>
--@ft<@i< see 6.1 for declaration of Random>>>
@xcode<Tomorrow := ((Yesterday @b<with delta> Day =@> 12) @b<with delta> Month =@> April); --@ft<@i< see 3.8>>>
The base expression may also be class-wide:
@xcode<@b<function> Translate (P : Point'Class; X, Y : Real) @b<return> Point'Class @b<is>
(P @b<with delta> X =@> P.X + X,
Y =@> P.Y + Y); --@ft<@i< see 3.9 for declaration of type Point>>>
!corrigendum 4.3.5(0)
!AI-0212-1
!AI-0250-1
!AI-0312-1
!AI-0327-1
@dinsc
In a @fa<container_aggregate>, values are specified for elements of a
container; for a @fa<positional_container_aggregate>, the elements are given
sequentially; for a @fa<named_container_aggregate>, the elements are
specified by a sequence of key/value pairs, or using an iterator.
The Aggregate aspect of the type of the @fa<aggregate> determines how the
elements are combined to form the container.
For a type other than an array type, the following type-related
operational aspect may be specified:
@xhang<@xterm<Aggregate>This aspect is an @fa<aggregate> of the form:>
@xindent<@ @ @ (Empty =@> @fa<name>[,@hr
@ @ @ @ Add_Named =@> @i<procedure_>@fa<name>][,@hr
@ @ @ @ Add_Unnamed =@> @i<procedure_>@fa<name>][,@hr
@ @ @ @ New_Indexed =@> @i<function_>@fa<name>,@hr
@ @ @ @ Assign_Indexed =@> @i<procedure_>@fa<name>])>
@xindent<The type for which this aspect is specified is known as the
@i<container type> of the Aggregate aspect.
A @i<procedure_>@fa<name> shall be specified for at least one of
Add_Named, Add_Unnamed, or Assign_Indexed. If Add_Named is specified, neither
Add_Unnamed nor Assign_Indexed shall be specified. Either both or
neither of New_Indexed and Assign_Indexed shall be specified.>
@s8<@i<Name Resolution Rules>>
The @fa<name> specified for Empty for an Aggregate aspect shall denote a
constant of the container type, or denote a function with a result type
of the container type that has no parameters,
or that has one @b<in> parameter of type Integer.
The @i<procedure_>@fa<name> specified for Add_Unnamed for an Aggregate
aspect shall
denote a procedure that has two parameters, the first an @b<in out>
parameter of the container type, and the second an @b<in> parameter of some
nonlimited type, called the @i<element type> of the container type.
The @i<function_>@fa<name> specified for New_Indexed for an
Aggregate aspect shall denote
a function with a result type of the container type, and two parameters of the
same discrete type, with that type being the @i<key type> of the container type.
The @i<procedure_>@fa<name> specified for Add_Named or Assign_Indexed for an
Aggregate aspect
shall denote a procedure that has three parameters, the first an @b<in out>
parameter of the container type, the second an @b<in> parameter of a nonlimited
type (the @i<key type> of the container type), and the third, an @b<in>
parameter of a nonlimited type that is called the @i<element type> of the
container type.
@s8<@i<Legality Rules>>
If the container type of an Aggregate aspect is a private type, the full
type of the container type shall not be an array type. If the container type is
limited, the name specified for Empty shall denote a function rather than a
constant object.
For an Aggregate aspect, the key type of Assign_Indexed shall be the same
type as that of the parameters of New_Indexed. Additionally, if both
Add_Unnamed and Assign_Indexed are specified, the final parameters shall
be of the same type @emdash the element type of the container type.
@s8<@i<Static Semantics>>
The Aggregate aspect is nonoverridable.
@s8<@i<Syntax>>
@xindent<@fa<container_aggregate>@fa<@ ::=@ >@hr
@ @ @ @ @fa<null_container_aggregate>@hr
@ @ |@ @fa<positional_container_aggregate>@hr
@ @ |@ @fa<named_container_aggregate>>
@xindent<@fa<null_container_aggregate>@fa<@ ::=@ >'['@ ']'>
@xindent<@fa<positional_container_aggregate>@fa<@ ::=@ >'['@ @fa<expression>{,@ @fa<expression>}@ ']'>
@xindent<@fa<named_container_aggregate>@fa<@ ::=@ >'['@ @fa<container_element_association_list>@ ']'>
@xindent<@fa<container_element_association_list>@fa<@ ::=@ >@hr
@ @ @ @ @fa<container_element_association>@ {,@ @fa<container_element_association>}>
@xindent<@fa<container_element_association>@fa<@ ::=@ >@hr
@ @ @ @ @fa<key_choice_list> =@> @fa<expression>@hr
@ @ |@ @fa<key_choice_list> =@> <@>@hr
@ @ |@ @fa<iterated_element_association>>
@xindent<@fa<key_choice_list>@fa<@ ::=@ >@fa<key_choice>@ {'|'@ @fa<key_choice>}>
@xindent<@fa<key_choice>@fa<@ ::=@ >@i<key_>@fa<expression>@ |@ @fa<discrete_range>>
@xindent<@fa<iterated_element_association>@fa<@ ::=@ >@hr
@ @ @ @ @b<for>@ @fa<loop_parameter_specification>[@ @b<use>@ @i<key_>@fa<expression>]@ =@>@ @fa<expression>@hr
@ @ |@ @b<for>@ @fa<iterator_specification>[@ @b<use>@ @i<key_>@fa<expression>]@ =@>@ @fa<expression>>
@s8<@i<Name Resolution Rules>>
The expected type for a @fa<container_aggregate> shall be a type for which
the Aggregate aspect has been specified. The expected type for each
@fa<expression> of a @fa<container_aggregate> is the element type of the expected
type.
The expected type for a @i<key_>@fa<expression>, or a @fa<discrete_range> of a
@fa<key_choice>, is the key type of the expected type of the @fa<aggregate>.
@s8<@i<Legality Rules>>
The expected type for a @fa<positional_container_aggregate> shall have an
Aggregate aspect that includes a specification for an Add_Unnamed
procedure or an Assign_Indexed procedure. The expected type for a
@fa<named_container_aggregate> that contains one or more
@fa<iterated_element_association>s with a @i<key_>@fa<expression> shall have an
Aggregate aspect that includes a specification for the Add_Named
procedure. The expected type for a @fa<named_container_aggregate> that
contains one or more @fa<key_choice_list>s shall have an Aggregate aspect
that includes a specification for the Add_Named or Assign_Indexed
procedure. A @fa<null_container_aggregate> can be of any type
with an Aggregate aspect.
A non-null container aggregate is called an @i<indexed aggregate> if the
expected type @i<T> of the aggregate specifies an Assign_Indexed procedure
in its Aggregate aspect, and either there is no Add_Unnamed procedure
specified for the type, or the aggregate is a @fa<named_container_aggregate>
with a @fa<container_element_association> that contains a @fa<key_choice_list>
or a @fa<loop_parameter_specification>. The key type of an indexed aggregate
is also called the @i<index type> of the aggregate.
A @fa<container_element_association> with a <@> rather than an @fa<expression>,
or with a @fa<key_choice> that is a @fa<discrete_range>, is permitted only in
an indexed aggregate.
For an @fa<iterated_element_association> without a @i<key_>@fa<expression>, if the
@fa<aggregate> is an indexed aggregate or the expected type of the
@fa<aggregate> specifies an Add_Named procedure in its Aggregate aspect, then
the type of the loop parameter of the @fa<iterated_element_association> shall
be the same as the key type of the @fa<aggregate>.
For a @fa<named_container_aggregate> that is an indexed aggregate, all
@fa<container_element_association>s shall contain either a @fa<key_choice_list>,
or a @fa<loop_parameter_specification> without a @i<key_>@fa<expression> or
@fa<iterator_filter>. Furthermore, for such an aggregate, either:
@xbullet<all @fa<key_choice>s shall be static expressions or static ranges,
and every @fa<loop_parameter_specification> shall have a
@fa<discrete_subtype_definition> that defines a non-null static range,
and the set of values of the index type covered by the
@fa<key_choice>s and the @fa<discrete_subtype_definition>s shall form a
contiguous range of values with no duplications; or>
@xbullet<there shall be exactly one @fa<container_element_association>, and if
it has a @fa<key_choice_list>, the list shall have exactly one @fa<key_choice>.>
@s8<@i<Dynamic Semantics>>
The evaluation of a @fa<container_aggregate> starts by creating an anonymous
object @i<A> of the expected type @i<T> initialized as follows:
@xbullet<if the @fa<aggregate> is an indexed aggregate, from the result of a
call on the New_Indexed function; the actual parameters in this call
represent the lower and upper bound of the @fa<aggregate>, and are
determined as follows:>
@xinbull<if the @fa<aggregate> is a @fa<positional_container_aggregate>, the
lower bound is the low bound of the subtype of the key parameter of the
Add_Indexed procedure, and the upper bound has a position number
that is the sum of the position number of the lower bound and
one less than the number of @fa<expression>s in the @fa<aggregate>;>
@xinbull<if the @fa<aggregate> is a @fa<named_container_aggregate>, the lower
bound is the lowest value covered by a @fa<key_choice_list> or is the low
bound of a range defined by a @fa<discrete_subtype_definition> of a
@fa<loop_parameter_specification>; the upper bound is the highest
value covered by a @fa<key_choice_list> or is the high bound of a
range defined by a @fa<discrete_subtype_definition> of a
@fa<loop_parameter_specification>.>
@xbullet<if the @fa<aggregate> is not an indexed aggregate, by assignment
from the Empty constant, or from a call on the Empty function specified in
the Aggregate aspect. In the case of an Empty function with a formal
parameter, the actual parameter has the following value:>
@xinbull<for a @fa<null_container_aggregate>, the value zero;>
@xinbull<for a @fa<positional_container_aggregate>, the number of
@fa<expression>s;>
@xinbull<for a @fa<named_container_aggregate> without an
@fa<iterated_element_association>, the number of @i<key_>@fa<expression>s;>
@xinbull<for a @fa<named_container_aggregate> where every
@fa<iterated_element_association> contains a @fa<loop_parameter_specification>,
the total number of elements specified by all of the
@fa<container_element_association>s;>
@xinbull<otherwise, to an implementation-defined value.>
The evaluation then proceeds as follows:
@xbullet<for a @fa<null_container_aggregate>, the anonymous object @i<A>
is the result;>
@xbullet<for a @fa<positional_container_aggregate> of a type with a specified
Add_Unnamed procedure, each @fa<expression> is evaluated in an arbitrary
order, and the Add_Unnamed procedure is invoked in sequence with the
anonymous object @i<A> as the first parameter and the result of
evaluating each @fa<expression> as the second parameter, in the order of
the @fa<expression>s;>
@xbullet<for a @fa<positional_container_aggregate> that is an indexed
aggregate, each @fa<expression> is evaluated in an arbitrary order, and the
Assign_Indexed procedure is invoked in sequence with the anonymous
object @i<A> as the first parameter, the key value as the second
parameter, computed by starting with the low bound of the subtype of
the key formal parameter of the Assign_Indexed procedure and taking
the successor of this value for each successive @fa<expression>, and the
result of evaluating each @fa<expression> as the third parameter;>
@xbullet<for a @fa<named_container_aggregate> for a type with an Add_Named
procedure in its Aggregate aspect, the @fa<container_element_association>s
are evaluated in an arbitrary order:>
@xinbull<for a @fa<container_element_association> with a @fa<key_choice_list>,
for each @fa<key_choice> of the list in an arbitrary order, the
@fa<key_choice> is evaluated as is the @fa<expression> of the
@fa<container_element_association> (in an arbitrary order), and the
Add_Named procedure is invoked once for each value covered by the
@fa<key_choice>, with the anonymous object @i<A> as the first parameter,
the value from the @fa<key_choice> as the second parameter, and the
result of evaluating the @fa<expression> as the third parameter;>
@xinbull<for a @fa<container_element_association> with an
@fa<iterated_element_association>, first the @fa<iterated_element_association> is
elaborated, then an iteration is performed, and for each value conditionally
produced by the iteration (see 5.5 and 5.5.2) the Add_Named
procedure is invoked with the anonymous object @i<A> as the first parameter,
the result of evaluating the @fa<expression> as the third parameter, and:>
@xI2bull<if there is a @i<key_>@fa<expression>, the result of evaluating
the @i<key_>@fa<expression> as the second parameter;>
@XI2Bull<otherwise, with the loop parameter as the second parameter;>
@xbullet<for a @fa<named_container_aggregate> that is an indexed aggregate,
the evaluation proceeds as above for the case of Add_Named, but with
the Assign_Indexed procedure being invoked in its stead; in the
case of a @fa<container_element_association> with a <@> rather than an
@fa<expression>, the corresponding call on Assign_Indexed is not
performed, leaving the component as it was upon return from the New_Indexed
function;>
@xbullet<for any other @fa<named_container_aggregate>, the
@fa<container_element_association>s (which are necessarily
@fa<iterated_element_association>s) are evaluated in the order given; each
such evaluation comprises two steps:>
@xhang<@xterms<1.>the @fa<iterated_element_association> is elaborated;>
@xhang<@xterms<2.>an iteration is performed, and for each value conditionally
produced by the iteration (see 5.5 and 5.5.2) the Add_Unnamed
procedure is invoked, with the anonymous object @i<A> as the first parameter
and the result of evaluating the @fa<expression> as the second parameter.>
@s8<@i<Examples>>
Declarations of Set_Type, Map_Type, and Vector_Type:
@xcode< -- @ft<@i<Set_Type is a set-like container type.>>
@b<type> Set_Type @b<is private>
@b<with> Aggregate =@> (Empty =@> Empty_Set,
Add_Unnamed =@> Include);
@b<function> Empty_Set @b<return> Set_Type;>
@xcode< @b<subtype> Small_Natural @b<is> Natural @b<range> 0..1000;>
@xcode< @b<procedure> Include (S : @b<in out> Set_Type; N : @b<in> Small_Natural);>
@xcode< -- @ft<@i<Map_Type is a map-like container type.>>
@b<type> Map_Type @b<is private>
@b<with> Aggregate =@> (Empty =@> Empty_Map,
Add_Named =@> Add_To_Map);>
@xcode< @b<procedure> Add_To_Map (M : @b<in out> Map_Type; Key : @b<in> Integer; Value : @b<in> String);>
@xcode< Empty_Map : @b<constant> Map_Type;>
@xcode< -- @ft<@i<Vector_Type is an extensible array-like container type.>>
@b<type> Vector_Type @b<is private>
@b<with> Aggregate =@> (Empty =@> Empty_Vector,
Add_Unnamed =@> Append_One,
New_Indexed =@> New_Vector,
Assign_Indexed =@> Assign_Element);>
@xcode< @b<function> Empty_Vector (Capacity : Count_Type := 0) @b<return> Vector_Type;>
@xcode< @b<procedure> Append_One (V : @b<in out> Vector_Type; New_Item : @b<in> String);>
@xcode< @b<procedure> Assign_Element (V : @b<in out> Vector_Type;
Index : @b<in> Positive;
Item : @b<in> String);>
@xcode< @b<function> New_Vector (First, Last : Positive) @b<return> Vector_Type
@b<with> Pre =@> First = Positive'First;
-- @ft<@i<Vectors are always indexed starting at the>>
-- @ft<@i<lower bound of their index subtype.>>>
@xcode<-- @ft<@i<Private part not shown.>>>
Examples of container aggregates for Set_Type, Map_Type, and Vector_Type:
@xcode<-- @ft<@i<Example aggregates using Set_Type.>>
S : Set_Type;>
@xcode<-- @ft<@i<Assign the empty set to S:>>
S := [];>
@xcode<-- @ft<@i<Is equivalent to:>>
S := Empty_Set;>
@xcode<-- @ft<@i<A positional set aggregate:>>
S := [1, 2];>
@xcode<-- @ft<@i<Is equivalent to:>>
S := Empty_Set;
Include (S, 1);
Include (S, 2);>
@xcode<-- @ft<@i<A set aggregate with an >>@fa<iterated_element_association>@ft<@i<:>>
S := [@b<for> Item @b<in> 1 .. 5 =@> Item * 2];>
@xcode<-- @ft<@i<Is equivalent to:>>
S := Empty_Set;
@b<for> Item @b<in> 1 .. 5 @b<loop>
Include (S, Item * 2);
@b<end loop>;>
@xcode<-- @ft<@i<A set aggregate consisting of two >>@fa<iterated_element_association>@ft<@i<s:>>
S := [@b<for> Item @b<in> 1 .. 5 =@> Item,
@b<for> Item @b<in> 1 .. 5 =@> -Item];>
@xcode<-- @ft<@i<Is equivalent (assuming set semantics) to:>>
S := Empty_Set;
@b<for> Item @b<in> -5 .. 5 @b<loop>
@b<if> Item /= 0 @b<then>
Include (S, Item);
@b<end if>;
@b<end loop>;>
@xcode<-- @ft<@i<Example aggregates using Map_Type.>>
M : Map_Type;>
@xcode<-- @ft<@i<A simple named map aggregate:>>
M := [12 =@> "house", 14 =@> "beige"];>
@xcode<-- @ft<@i<Is equivalent to:>>
M := Empty_Map;
Add_To_Map (M, 12, "house");
Add_To_Map (M, 14, "beige");>
@xcode<-- @ft<@i<Define a table of pairs:>>
@b<type> Pair @b<is record>
Key : Integer;
Value : @b<access constant> String;
@b<end record>;>
@xcode<Table : @b<constant array>(Positive @b<range> <@>) @b<of> Pair :=
[(Key =@> 33, Value =@> @b<new> String'("a nice string")),
(Key =@> 44, Value =@> @b<new> String'("an even better string"))];>
@xcode<-- @ft<@i<A map aggregate using an >>@fa<iterated_element_association>
-- @ft<@i<and a key_>>@fa<expression>@ft<@i<, built from from a table of key/value pairs:>>
M := [@b<for> P @b<of> Table @b<use> P.Key =@> P.Value.@b<all>];>
@xcode<-- @ft<@i<Is equivalent to:>>
M := Empty_Map;
@b<for> P @b<of> Table @b<loop>
Add_To_Map (M, P.Key, P.Value.@b<all>);
@b<end loop>;>
@xcode<-- @ft<@i<Create an image table for an array of integers:>>
Keys : @b<constant array>(Positive @b<range> <@>) @b<of> Integer := [2, 3, 5, 7, 11];>
@xcode<-- @ft<@i<A map aggregate where the values produced by the>>
-- @fa<iterated_element_association>@ft<@i< are of the same type as the key>>
-- @ft<@i<(eliminating the need for a separate key_>>@fa<expression>@ft<@i<):>>
M := [@b<for> Key @b<of> Keys =@> Integer'Image (Key)];>
@xcode<-- @ft<@i<Is equivalent to:>>
M := Empty_Map;
@b<for> Key @b<of> Keys @b<loop>
Add_To_Map (M, Key, Integer'Image (Key));
@b<end loop>;>
@xcode<-- @ft<@i<Example aggregates using Vector_Type.>>
V : Vector_Type;>
@xcode<-- @ft<@i<A positional vector aggregate:>>
V := ["abc", "def"];>
@xcode<-- @ft<@i<Is equivalent to:>>
V := Empty_Vector (2);
Append_One (V, "abc");
Append_One (V, "def");>
@xcode<-- @ft<@i<An indexed vector aggregate:>>
V := [1 =@> "this", 2 =@> "is", 3 =@> "a", 4 =@> "test"];>
@xcode<-- @ft<@i<Is equivalent to:>>
V := New_Vector (1, 4);
Assign_Element (V, 1, "this");
Assign_Element (V, 2, "is");
Assign_Element (V, 3, "a");
Assign_Element (V, 4, "test");>
@xcode<-- @ft<@i<A vector made from the elements of a map:>>
V := [@b<for> Elem @b<of> M =@> Elem];>
@xcode<-- @ft<@i<Is equivalent to:>>
V := Empty_Vector (<estimate of size of M@>);
@b<for> Elem @b<of> M @b<loop>
Add_Positional (V, Elem);
@b<end loop>;>
!corrigendum 4.5.9(0)
!AI-0236-1
!AI-0317-1
@dinsc
Declare expressions provide a way to declare local constants and object
renamings in an expression context.
@s8<@i<Syntax>>
@xindent<@fa<declare_expression>@fa<@ ::=@ >@hr
@ @ @ @ @b<declare> {@fa<declare_item>}@hr
@ @ @ @ @b<begin> @i<body_>@fa<expression>>
@xindent<@fa<declare_item>@fa<@ ::=@ >@fa<object_declaration>@ |@ @fa<object_renaming_declaration>>
Wherever the Syntax Rules allow an @fa<expression>, a @fa<declare_expression>
may be used in place of the @fa<expression>, so long as it is immediately
surrounded by parentheses.
@s8<@i<Legality Rules>>
A @fa<declare_item> that is an @fa<object_declaration> shall declare a
constant of a nonlimited type.
A @fa<declare_item> that is an @fa<object_renaming_declaration> (see 8.5.1) shall
not rename an object of a limited type if any operative constituent
of the @i<object_>@fa<name> is a value conversion or is newly constructed
(see 4.4).
The following are not allowed within a @fa<declare_expression>: a declaration
containing the reserved word @b<aliased>; the @fa<attribute_designator> Access
or Unchecked_Access; or an anonymous access type.
@s8<@i<Name Resolution Rules>>
If a @fa<declare_expression> is expected to be of a type @i<T>, then the
@i<body_>@fa<expression> is expected to be of type @i<T>. Similarly, if a
@fa<declare_expression> is expected to be of some class of types, then the
@i<body_>@fa<expression> is subject to the same expectation. If a
@fa<declare_expression> shall resolve to be of a type @i<T>, then the
@i<body_>@fa<expression> shall resolve to be of type @i<T>.
The type of a @fa<declare_expression> is the type of the
@i<body_>@fa<expression>.
@s8<@i<Dynamic Semantics>>
For the evaluation of a @fa<declare_expression>, the @fa<declare_item>s are
elaborated in order, and then the @i<body_>@fa<expression> is evaluated. The
value of the @fa<declare_expression> is that of the @i<body_>@fa<expression>.
@s8<@i<Examples>>
The postcondition for Ada.Containers.Vectors."&" (see A.18.2) could have
been written:
@xcode<@b<with> Post =@>
(@b<declare>
Result @b<renames> Vectors."&"'Result;
Length : @b<constant> Count_Type := Left.Length + Right.Length;
@b<begin>
Result.Length = Length @b<and then>
@b<not> Tampering_With_Elements_Prohibited (Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Result) @b<and then>
Result.Capacity @>= Length)>
!corrigendum 4.5.10(0)
!AI-0242-1
!AI-0250-1
!AI-0262-1
!AI-0327-1
!AI-0348-1
!AI-0379-1
@dinsc
Reduction expressions provide a way to map or transform a collection of
values into a new set of values, and then summarize the values produced by
applying an operation to reduce the set to a single value result.
A reduction expression is represented as an @fa<attribute_reference> of the
reduction attributes Reduce or Parallel_Reduce.
@s8<@i<Syntax>>
@xindent<@fa<reduction_attribute_reference>@fa<@ ::=@ >@hr
@ @ @ @ @fa<value_sequence>'@fa<reduction_attribute_designator>@hr
@ @ |@ @fa<prefix>'@fa<reduction_attribute_designator>>
@xindent<@fa<value_sequence>@fa<@ ::=@ >@hr
@ @ @ @ '['@ [@b<parallel>[(@fa<chunk_specification>)]]@ @fa<iterated_element_association>@ ']'>
@xindent<@fa<reduction_attribute_designator>@fa<@ ::=@ >@i<reduction_>@fa<identifier>(@fa<reduction_specification>)>
@xindent<@fa<reduction_specification>@fa<@ ::=@ >@i<reducer_>@fa<name>,@ @i<initial_value_>@fa<expression>>
The @fa<iterated_element_association> of a @fa<value_sequence> shall not have
a @i<key_>@fa<expression>, nor shall it have a
@fa<loop_parameter_specification> that has the reserved word @b<reverse>.
The @fa<chunk_specification>, if any, of a @fa<value_sequence> shall be an
@i<integer_>@fa<simple_expression>.
@s8<@i<Name Resolution Rules>>
The expected type for a @fa<reduction_attribute_reference> shall be a single
nonlimited type.
In the remainder of this subclause,
we will refer to nonlimited subtypes @i<Value_Type> and @i<Accum_Type> of a
@fa<reduction_attribute_reference>. These subtypes and interpretations of
the @fa<name>s and @fa<expression>s of a @fa<reduction_attribute_reference>
are determined by the following rules:
@xbullet<@i<Accum_Type> is a subtype of the expected type of
the @fa<reduction_attribute_reference>.>
@xbullet<A @i<reducer subprogram> is either subtype conformant with the following
specification:>
@xcode< @b<function> Reducer(Accumulator : @i<Accum_Type>; Value : @i<Value_Type>) @b<return> @i<Accum_Type>;>
@xindent<or is subtype conformant with the following specification:>
@xcode< @b<procedure> Reducer(Accumulator : @b<in out> @i<Accum_Type>; Value : @b<in> @i<Value_Type>);>
@xbullet<The @i<reducer_>@fa<name> of a @fa<reduction_specification> denotes a
reducer subprogram.>
@xbullet<The expected type of an @i<initial_value_>@fa<expression> of a
@fa<reduction_specification> is that of subtype @i<Accum_Type>.>
@xbullet<The expected type of the @fa<expression> of the
@fa<iterated_element_association> of a @fa<value_sequence>
is that of subtype @i<Value_Type>.>
@s8<@i<Legality Rules>>
If the @fa<reduction_attribute_reference> has a @fa<value_sequence> with the
reserved word @b<parallel>, the subtypes @i<Accum_Type> and @i<Value_Type>
shall statically match.
If the @fa<identifier> of a @fa<reduction_attribute_designator> is
Parallel_Reduce, the subtypes @i<Accum_Type> and @i<Value_Type> shall
statically match.
@s8<@i<Static Semantics>>
A @fa<reduction_attribute_reference> denotes a value, with nominal subtype
being the subtype of the first parameter of the subprogram denoted by the
@i<reducer_>@fa<name>.
@s8<@i<Dynamic Semantics>>
For the evaluation of a @fa<value_sequence>, the
@fa<iterated_element_association> is elaborated, then an iteration is
performed, and for each value conditionally produced by the iteration (see
5.5 and 5.5.2), the associated @fa<expression> is evaluated with the loop
parameter having this value, to produce a result that is converted to
Value_Type, and used to define the next value in the sequence.
If the @fa<value_sequence> does not have the reserved word @b<parallel>, it is
produced as a single sequence of values by a single logical thread of
control. If the reserved word @b<parallel> is present in the @fa<value_sequence>,
the enclosing @fa<reduction_attribute_reference> is a parallel construct, and
the sequence of values is generated by a parallel iteration (as
defined in 5.5, 5.5.1, and 5.5.2), as a set of non-empty, non-overlapping
contiguous chunks (@i<subsequences>) with one logical thread of control (see
clause 9) associated with each subsequence. If there is a
@fa<chunk_specification>, it determines the maximum number of chunks, as
defined in 5.5; otherwise the maximum number of chunks is implementation defined.
For a @fa<value_sequence> V, the following attribute is defined:
@xhang<@xterm<V'Reduce(Reducer, Initial_Value)>
This attribute represents a @i<reduction expression>, and is in the
form of a @fa<reduction_attribute_reference>.>
@xindent<The evaluation of a use of this attribute begins by evaluating the
parts of the @fa<reduction_attribute_designator> (the @i<reducer_>@fa<name>
Reducer and the @i<initial_value_>@fa<expression> Initial_Value), in an
arbitrary order. It then
initializes the @i<accumulator> of the reduction expression to the value
of the @i<initial_value_>@fa<expression> (the @i<initial value>). The
@fa<value_sequence> V is then evaluated.>
@xindent<If the @fa<value_sequence> does not have the reserved word
@b<parallel>, each value of the @fa<value_sequence> is passed, in order,
as the second (Value) parameter to a call on Reducer, with the first
(Accumulator) parameter being the prior value of the accumulator,
saving the result as the new value of the accumulator. The reduction
expression yields the final value of the accumulator.>
@xindent<If the reserved word @b<parallel> is present in a
@fa<value_sequence>, then
the (parallel) reduction expression is a parallel construct and the
sequence has been partitioned into one or more subsequences (see
above) each with its own separate logical thread of control.>
@xindent<Each logical thread of control creates a local accumulator for
processing its subsequence. The accumulator for a subsequence is initialized
to the first value of the subsequence, and calls on Reducer start with the
second value of the subsequence (if any). The result for the
subsequence is the final value of its local accumulator.>
@xindent<After all logical threads of control of a parallel reduction
expression have completed, Reducer is called for each
subsequence, in the original sequence order, passing the local
accumulator for that subsequence as the second (Value) parameter, and
the overall accumulator (initialized above to the initial
value) as the first (Accumulator) parameter, with the result saved
back in the overall accumulator. The parallel reduction expression
yields the final value of the overall accumulator.>
@xindent<If the evaluation of the @fa<value_sequence> yields an empty
sequence of values, the reduction expression yields the initial value.>
@xindent<If an exception is propagated by one of the calls on Reducer,
that exception is propagated from the reduction expression. If different
exceptions are propagated in different logical threads of control, one is
chosen arbitrarily to be
propagated from the reduction expression as a whole.>
For a @fa<prefix> X of an
array type (after any implicit dereference), or that denotes an iterable container
object (see 5.5.1), the following attributes are defined:
@xhang<@xterm<X'Reduce(Reducer, Initial_Value)>X'Reduce
is a reduction expression that yields a result equivalent to
replacing the @fa<prefix> of the attribute with the @fa<value_sequence>:>
@xcode< [@b<for> Item @b<of> X =@> Item]>
@xhang<@xterm<X'Parallel_Reduce(Reducer, Initial_Value)>X'Parallel_Reduce
is a reduction expression that yields a result
equivalent to replacing the attribute @fa<identifier> with
Reduce and the @fa<prefix> of the attribute with the
@fa<value_sequence>:>
@xcode< [@b<parallel for> Item @b<of> X =@> Item]>
@s8<@i<Bounded (Run-Time) Errors>>
For a parallel reduction expression, it is a bounded error if the reducer
subprogram is not associative. That is, for any arbitrary values of subtype
@i<Value_Type> @i<A>, @i<B>, @i<C> and a reducer function @i<R>, the result of
@i<R> (@i<A>, @i<R> (@i<B>, @i<C>)) should produce a result equal to
@i<R> (@i<R> (@i<A>, @i<B>), @i<C>)). The possible consequences
are Program_Error, or a result that does not match the equivalent sequential
reduction expression due to the order of calls on the reducer subprogram being
unspecified in the overall reduction. Analogous rules apply in the case of a
reduction procedure.
@s8<@i<Examples>>
An expression function that returns its result as a Reduction Expression:
@xcode<@b<function> Factorial(N : Natural) @b<return> Natural @b<is>
([@b<for> J @b<in> 1..N =@> J]'Reduce("*", 1));>
An expression function that computes the Sine of X using a Taylor expansion:
@xcode<@b<function> Sine (X : Float; Num_Terms : Positive := 5) @b<return> Float @b<is>
([@b<for> I @b<in> 1..Num_Terms =@> (-1.0)**(I-1) * X**(2*I-1)/Float(Factorial(2*I-1))]
'Reduce("+", 0.0));>
A reduction expression that outputs the sum of squares:
@xcode<Put_Line ("Sum of Squares is" &
Integer'Image([@b<for> I @b<in> 1 .. 10 =@> I**2]'Reduce("+", 0)));>
An expression function to compute the value of Pi:
@xcode<-- @ft<@i<See 3.5.7.>>
@b<function> Pi (Number_Of_Steps : Natural := 10_000) @b<return> Real @b<is>
(1.0 / Real (Number_Of_Steps) *
[@b<for> I @b<in> 1 .. Number_Of_Steps =@>
(4.0 / (1.0 + ((Real (I) - 0.5) *
(1.0 / Real (Number_Of_Steps)))**2))]
'Reduce("+", 0.0));>
Calculate the sum of elements of an array of integers:
@xcode<A'Reduce("+",0) -- @ft<@i<See 4.3.3.>>>
Determine if all elements in a two-dimensional array of booleans are
set to true:
@xcode<Grid'Reduce("and", True) -- @ft<@i<See 3.6.>>>
Calculate the minimum value of an array of integers in parallel:
@xcode<A'Parallel_Reduce(Integer'Min, Integer'Last)>
A parallel reduction expression used to calculate the mean of the
elements of a two-dimensional array of subtype Matrix (see 3.6) that
are greater than 100.0:
@xcode<@b<type> Accumulator @b<is record>
Sum : Real; --
Count : Integer;
@b<end record>;>
@xcode<@b<function> Accumulate (L, R : Accumulator) @b<return> Accumulator @b<is>
(Sum =@> L.Sum + R.Sum,
Count =@> L.Count + R.Count);>
@xcode<@b<function> Average_of_Values_Greater_Than_100 (M : Matrix) @b<return> Real @b<is>
(@b<declare>
Acc : @b<constant> Accumulator :=
[@b<parallel for> Val @b<of> M @b<when> Val @> 100.0 =@> (Val, 1)]
'Reduce(Accumulate, (Sum =@> 0, Count =@> 0));
@b<begin>
Acc.Sum / Real(Acc.Count));>
!corrigendum 4.9(8)
!AI-0064-2
!AI-0368-1
@drepl
@xbullet<an @fa<attribute_reference> whose @fa<prefix> statically denotes a
statically constrained array object or array subtype, and whose
@fa<attribute_designator> is First, Last, or Length, with an optional
dimension;>
@dby
@xbullet<an @fa<attribute_reference> whose @fa<prefix> statically names a
statically constrained array object or array subtype, and whose
@fa<attribute_designator> is First, Last, or Length, with an optional
dimension;>
@xbullet<an @fa<attribute_reference> whose @fa<prefix> denotes a non-generic
entity that is not declared in a generic unit, and whose
@fa<attribute_designator> is Nonblocking;>
!corrigendum 4.9(17)
!AI-0368-1
!AI-0373-1
@dinsa
@xbullet<It denotes a @fa<renaming_declaration> with a @fa<name> that
statically denotes the renamed entity.>
@dinss
A @fa<name> @i<statically names> an object if it:
@xbullet<statically denotes the declaration of an object (possibly
through one or more renames);>
@xbullet<is a @fa<selected_component> whose prefix statically names an object,
there is no implicit dereference of the prefix, and the @fa<selector_name>
does not denote a @fa<component_declaration> occurring within a
@fa<variant_part>; or>
@xbullet<is an @fa<indexed_component> whose prefix statically names an object,
there is no implicit dereference of the prefix, the object is statically
constrained, and the index expressions of the object are static and have
values that are within the range of the index constraint.>
For an entity other than an object, a @fa<name> statically names an entity if
the @fa<name> statically denotes the entity.
!corrigendum 4.9(20)
Replace the paragraph:
- a predefined concatenation operator whose result type is a string
type;
by:
- a predefined concatenation operator whose result type is a string
type that is not a descendant of a formal array type;
- a shifting or rotating function associated with a modular
type declared in package Interfaces (see B.2);
!corrigendum 4.10(0)
!AI-0020-1
!AI-0250-1
!AI-0315-1
!AI-0340-1
@dinsc
An @i<image> of a value is a string representing the value in display form.
The attributes Image, Wide_Image, and Wide_Wide_Image are available
to produce the image of a value as a String, Wide_String, or
Wide_Wide_String (respectively). User-defined images for a given type
can be implemented by overriding the default implementation of the
attribute Put_Image.
@s8<@i<Static Semantics>>
For every subtype S of a type T other than @i<universal_real> or
@i<universal_fixed>, the following
type-related operational attribute is defined:
@xhang<@xterm<S'Put_Image>
S'Put_Image denotes a procedure with the following specification:>
@xcode< @b<procedure> S'Put_Image
(@ft<@i<Buffer>> : @b<in out> Ada.Strings.Text_Buffers.Root_Buffer_Type'Class;
@ft<@i<Arg>> : @b<in> T);>
@xindent<The default implementation of S'Put_Image writes
(using Wide_Wide_Put) an @i<image> of the value of @i<Arg>.>
@xindent<The Put_Image attribute may be specified for any specific
type T either via an @fa<attribute_definition_clause> or via an
@fa<aspect_specification> specifying the Put_Image aspect of the type.>
The behavior of the default implementation of S'Put_Image depends
on the class of T. For an elementary type, the implementation is
equivalent to:
@xcode<@b<procedure> Scalar_Type'Put_Image
(Buffer : @b<in out> Ada.Strings.Text_Buffers.Root_Buffer_Type'Class;
Arg : @b<in> Scalar_Type) @b<is>
@b<begin>
Buffer.Wide_Wide_Put (@i<<described below@>>);
@b<end> Scalar_Type'Put_Image;>
where the Wide_Wide_String value written out to the stream is
defined as follows:
For an integer type, the image written out is the corresponding
decimal literal, without underlines, leading zeros, exponent, or
trailing spaces, but with a single leading character that is either
a minus sign or a space.
For an enumeration type, the image written out is either the
corresponding identifier in upper case or the corresponding character
literal (including the two apostrophes); neither leading nor trailing
spaces are included. For a @i<nongraphic character> (a value of a character
type that has no enumeration literal associated with it), the value is
a corresponding language-defined name in upper case (for example,
the image of the nongraphic character identified as @i<nul> is @fc<"NUL">
@emdash the quotes are not part of the image).
For a floating point type, the image written out is a decimal real
literal best approximating the value (rounded away from zero if
halfway between) with a single leading character that is either a minus
sign or a space, a single digit (that is nonzero unless the value is
zero), a decimal point, S'Digits-1 (see 3.5.8) digits after the
decimal point (but one if S'Digits is one), an upper case E, the sign
of the exponent (either + or -), and two or more digits (with leading
zeros if necessary) representing the exponent. If S'Signed_Zeros is
True, then the leading character is a minus sign for a negatively
signed zero.
For a fixed point type, the image written out is a decimal real literal
best approximating the value (rounded away from zero if halfway between)
with a single leading character that is either a minus sign or a space,
one or more digits before the decimal point (with no redundant leading
zeros), a decimal point, and S'Aft (see 3.5.10) digits after the
decimal point.
For an access type (named or anonymous), the image written out
depends on whether the value is @b<null>. If it is @b<null>, then the
image is @fc<"NULL">. Otherwise the image is a left parenthesis
followed by @fc<"ACCESS">, a space, and a sequence of graphic
characters, other than space or right parenthesis, representing the
location of the designated object, followed by a right parenthesis,
as in @fc<"(ACCESS FF0012AC)">.
For an array type T, the default implementation of T'Put_Image
generates an image based on (named, not positional) array aggregate
syntax (with '[' and ']' as the delimiters) using calls to the
Put_Image procedures of the index type(s) and the element type to
generate images for values of those types.
The case of a null array is handled specially, using ranges for
index bounds and @fc<"<@>"> as a syntactic component-value placeholder.
The order in which components are written for
a composite type is the same canonical order in
which components of a composite type T are written out
by the default implementation of T'Write. This is also the
order that is used in determining the meaning of a positional aggregate
of type T.
For a class-wide type, the default implementation of T'Put_Image
generates an image based on qualified expression syntax.
Wide_Wide_String'Write is called with Wide_Wide_Expanded_Name of
@i<Arg>'Tag. Then S'Put_Image is called, where S is the specific type
identified by @i<Arg>'Tag.
For a type extension, the default implementation of T'Put_Image
depends on whether there exists a noninterface ancestor of T (other
than T itself) for which the Put_Image aspect has been
explicitly specified. If so, then T'Put_Image will
generate an image based on extension aggregate syntax where the
ancestor type of the extension aggregate is the nearest ancestor type
whose Put_Image aspect has been specified.
If no such ancestor exists, then the default implementation of T'Put_Image
is the same as described below for an untagged record type.
For an untagged record type, a specific tagged record type other than
a type extension which meets the criteria described in the previous
paragraph, or a protected type, the default implementation of
T'Put_Image generates an image based on (named, not positional) record
aggregate syntax (except that for a protected type, the initial left
parenthesis is followed by @fc<"PROTECTED with ">).
Component names are displayed in upper case, following the rules for the
image of an enumeration value. Component values are displayed via calls to
the component type's Put_Image procedure.
The image written out for a record having no components (including
any interface type) is @fc<"(NULL RECORD)">. The image written out for a
componentless protected type is @fc<"(PROTECTED NULL RECORD)">.
In the case of a protected type T, a call to the default implementation
of T'Put_Image begins only one protected (read-only) action.
For an undiscriminated task type, the default implementation of T'Put_Image
generates an image of the form @fc<"(TASK <task_id_image@>)">
where <task_id_image> is the result obtained by calling
Task_Identification.Image with the id of the given task
and then passing that String to Characters.Conversions.To_Wide_Wide_String.
For a discriminated task type, the default implementation of T'Put_Image
also includes discriminant values, as in:
@xcode<"(TASK <task_id_image@> with D1 =@> 123, D2 =@> 456)">
For every subtype S of a type T, the following attributes are defined:
@xhang<@xterm<S'Wide_Wide_Image>
S'Wide_Wide_Image denotes a function with the following specification:>
@xcode< @b<function> S'Wide_Wide_Image(@ft<@i<Arg>> : S'Base)
@b<return> Wide_Wide_String>
@xindent<S'Wide_Wide_Image calls S'Put_Image
passing @i<Arg> (which will typically store a sequence of character values
in a text buffer) and then returns the
result of retrieving the contents of that buffer with Wide_Wide_Get. The
lower bound of the result is one.>
@xhang<@xterm<S'Wide_Image>
S'Wide_Image denotes a function with the following specification:>
@xcode< @b<function> S'Wide_Image(@ft<@i<Arg>> : S'Base)
@b<return> Wide_String>
@xindent<S'Wide_Image calls S'Put_Image
passing @i<Arg> (which will typically store a sequence of character values
in a text buffer) and then returns the
result of retrieving the contents of that buffer with Wide_Get. The
lower bound of the result is one.>
@xhang<@xterm<S'Image>
S'Image denotes a function with the following specification:>
@xcode< @b<function> S'Image(@ft<@i<Arg>> : S'Base)
@b<return> String>
@xindent<S'Image calls S'Put_Image
passing @i<Arg> (which will typically store a sequence of character values
in a text buffer) and then returns the
result of retrieving the contents of that buffer with Get. The
lower bound of the result is one.>
For a @fa<prefix> X of a type T other than @i<universal_real> or
@i<universal_fixed>, the following attributes are defined:
@xhang<@xterm<X'Wide_Wide_Image>
X'Wide_Wide_Image denotes the result of calling function
S'Wide_Wide_Image with @i<Arg> being X, where S is the nominal
subtype of X.>
@xhang<@xterm<X'Wide_Image>
X'Wide_Image denotes the result of calling function S'Wide_Image
with @i<Arg> being X, where S is the nominal subtype of X.>
@xhang<@xterm<X'Image>
X'Image denotes the result of calling function S'Image with @i<Arg>
being X, where S is the nominal subtype of X.>
@s8<@i<Implementation Permissions>>
An implementation may transform the image generated by the default
implementation of S'Put_Image for a composite subtype S in the
following ways:
@xbullet<If S is a composite subtype, the leading character of the image of
a component value or index value is a space, and the immediately
preceding character is an open parenthesis or bracket, then the space may
be omitted. The same transformation is also permitted if the leading
character of the component image is a space (in which case one of
the two spaces may be omitted).>
@xbullet<If S is an array subtype, the low bound of the array in each dimension
equals the low bound of the corresponding index subtype, and the
array value is not a null array value, then positional array
aggregate syntax may be used.>
@xbullet<If S is an array subtype and the given value can be displayed using
@fa<named_array_aggregate> syntax where some @fa<discrete_choice_list> identifies
more than one index value by identifying a sequence of one or more
ranges and values separated by vertical bars, then this
image may be generated instead; this may involve the reordering of
component values.>
@xbullet<Similarly, if S is a record subtype (or a discriminated type) and the
given value can be displayed using named component association syntax
where the length of some component_choice_list is greater than one,
then this image may be generated instead; this may involve the
reordering of component values.>
@xbullet<Additional spaces (Wide_Wide_Characters with position 32), and calls
to the New_Line operation of a text buffer, may be inserted to improve
readability of the generated image.>
For each language-defined nonscalar type T, T'Put_Image may be specified.
@s8<@i<Implementation Requirements>>
For each language-defined container type T (that is, each of the Vector,
List, Map, Set, Tree, and Holder types defined in the various
children of Ada.Containers), T'Put_Image shall be specified so
that T'Image produces a result consistent with array aggregate
syntax (using '[' and ']' as delimiters) as follows:
@xbullet<Vector images shall be consistent with the default image of
an array type with the same index and component types.>
@xbullet<Map images shall be consistent with named array aggregate
syntax, using key value images in place of discrete choice
names. For example, @fc<[Key1 =@> Value1, Key2 =@> Value2]>.>
@xbullet<Set, List, and Holder images shall be consistent with
positional array aggregate syntax. List elements shall
occur in order within an image of a list. The image of an empty
holder shall be @fc<[]>.>
@xbullet<Tree images (and images of subtrees of trees) shall be
consistent with positional array aggregate syntax.
For example, @fc<[[1, 2], [111, 222, 333]]>.>
For each language-defined nonscalar type T that has a primitive
language-defined Image function whose profile is type conformant with
that of T'Image (for example, Ada.Numerics.Float_Random.State has such
an Image function), T'Put_Image shall be specified so that T'Image
yields the same result as that Image function.
@s8<@i<Implementation Advice>>
For each language-defined private type T, T'Image should generate an image
that would be meaningful based only on the relevant public interfaces, as
opposed to requiring knowledge of the implementation of the private type.
!corrigendum 5.2.1(0)
!AI-0125-3
!AI-0322-1
!AI-0379-1
@dinsc
@@, known as the @i<target name> of an assignment statement,
provides an abbreviation to avoid repetition of potentially long
names in assignment statements.
@s8<@i<Syntax>>
@xindent<@fa<target_name>@fa<@ ::=@ >@@>
@s8<@i<Name Resolution Rules>>
If a @fa<target_name> occurs in an @fa<assignment_statement> @i<A>, the
@i<variable_>@fa<name> @i<V> of @i<A> is a complete context. The target name is a
constant view of @i<V>, having the nominal subtype of @i<V>.
@s8<@i<Legality Rules>>
A @fa<target_name> shall appear only in the @fa<expression> of an
@fa<assignment_statement>.
@s8<@i<Dynamic Semantics>>
For the execution of an @fa<assignment_statement> with one or more
@fa<target_name>s appearing in its @fa<expression>, the @i<variable_>@fa<name>
@i<V> of the @fa<assignment_statement> is evaluated first to determine the
object denoted by @i<V>, and then the @fa<expression> of the
@fa<assignment_statement> is evaluated with the evaluation of each
@fa<target_name> yielding a constant view of the the target whose properties
are otherwise identical to those of the view provided by @i<V>. The
remainder of the execution of the @fa<assignment_statement> is as given in
subclause 5.2.
@s8<@i<Examples>>
@xcode<Board(1, 1) := @@ + 1.0; -- @ft<@i<An abbreviation for Board(1, 1) := Board(1, 1) + 1.0;>>
-- @ft<@i<(Board is declared in 3.6.1).>>>
@xcode<My_Complex_Array : @b<array> (1 .. Max) @b<of> Complex; -- @ft<@i<See 3.3.2, 3.8.>>
...
-- @ft<@i<Square the element in the Count (see 3.3.1) position:>>
My_Complex_Array (Count) := (Re =@> @@.Re**2 - @@.Im**2,
Im =@> 2.0 @@.Re @@.Im);
-- @ft<@i<A target_name can be used multiple times and as a prefix if needed.>>>
!corrigendum 5.5(3/3)
!AI-0119-1
!AI-0189-1
!AI-0251-1
!AI-0266-1
!AI-0326-2
@drepl
@xindent<@fa<iteration_scheme>@fa<@ ::=@ >@b<while>@ @fa<condition>@hr
@ @ |@ @b<for>@ @fa<loop_parameter_specification>@hr
@ @ |@ @b<for>@ @fa<iterator_specification>>
@dby
@xindent<@fa<iteration_scheme>@fa<@ ::=@ >@b<while>@ @fa<condition>@hr
@ @ |@ @b<for>@ @fa<loop_parameter_specification>@hr
@ @ |@ @b<for>@ @fa<iterator_specification>@hr
@ @ |@ [@b<parallel>]@hr
@ @ @ @ @b<for>@ @fa<procedural_iterator>@hr
@ @ |@ @b<parallel>@ [(@fa<chunk_specification>)]@hr
@ @ @ @ @b<for>@ @fa<loop_parameter_specification>@hr
@ @ |@ @b<parallel>@ [(@fa<chunk_specification>)]@hr
@ @ @ @ @b<for>@ @fa<iterator_specification>>
@xindent<@fa<chunk_specification>@fa<@ ::=@ >@hr
@ @ @ @ @i<integer_>@fa<simple_expression>@hr
@ @ |@ @fa<defining_identifier>@ @b<in>@ @fa<discrete_subtype_definition>>
!corrigendum 5.5(5)
!AI-0119-1
!AI-0251-1
@dinsa
If a @fa<loop_statement> has a @i<loop_>@fa<statement_identifier>, then the
@fa<identifier> shall be repeated after the @b<end loop>; otherwise, there
shall not be an @fa<identifier> after the @fa<end loop>.
@dinst
An @fa<iteration_scheme> that begins with the reserved word @b<parallel> shall
not have the reserved word @b<reverse> in its @fa<loop_parameter_specification>.
@s8<@i<Name Resolution Rules>>
In a @fa<chunk_specification> that is an @i<integer_>@fa<simple_expression>, the
@i<integer_>@fa<simple_expression> is expected to be of any integer type.
!corrigendum 5.5(6)
!AI-0061-1
!AI-0251-1
@drepl
A @fa<loop_parameter_specification> declares a @i<loop parameter>,
which is an object whose subtype is that defined by the
@fa<discrete_subtype_definition>.
@dby
A @fa<loop_parameter_specification> declares a @i<loop parameter>,
which is an object whose subtype (and nominal subtype) is that defined
by the @fa<discrete_subtype_definition>.
In a @fa<chunk_specification> that has a @fa<discrete_subtype_definition>, the
@fa<chunk_specification> declares a @i<chunk parameter> object whose subtype
(and nominal subtype) is that defined by the @fa<discrete_subtype_definition>.
!corrigendum 5.5(7)
!AI-0119-1
!AI-0250-1
!AI-0327-1
@drepl
For the execution of a @fa<loop_statement>, the @fa<sequence_of_statements> is
executed repeatedly, zero or more times, until the @fa<loop_statement> is
complete. The @fa<loop_statement> is complete when a transfer of control
occurs that transfers control out of the loop, or, in the case of an
@fa<iteration_scheme>, as specified below.
@dby
The @i<filter> of an @i<iterator construct> (a @fa<loop_parameter_specification>,
@fa<iterator_specification>, or @fa<procedural_iterator>) is defined to be
@i<satisfied> when there is no @fa<iterator_filter> for the iterator construct,
or when the @fa<condition> of the @fa<iterator_filter> evaluates to True for
a given iteration of the iterator construct.
If a @fa<sequence_of_statements> of a @fa<loop_statement> with an iterator
construct is said to be @i<conditionally executed>, then the @fa<statement>s
are executed only when the filter of the iterator construct is satisfied.
The loop iterators @fa<loop_parameter_specification> and
@fa<iterator_specification> can also be used in contexts other than
@fa<loop_statement>s (for example, see 4.3.5 and 4.5.8). In such a context,
the iterator @i<conditionally produces> values in the order specified for
the associated construct below or in 5.5.2. The values produced are the
values given to the loop parameter when the filter of the iterator
construct is satisfied for that value. No value is produced
when the @fa<condition> of an @fa<iterator_filter> evaluates to False.
For the execution of a @fa<loop_statement>, the @fa<sequence_of_statements> is
executed zero or more times, until the @fa<loop_statement> is
complete. The @fa<loop_statement> is complete when a transfer of control
occurs that transfers control out of the loop, or, in the case of an
@fa<iteration_scheme>, as specified below.
!corrigendum 5.5(8)
!AI-0266-1
!AI-0294-1
@dinsa
For the execution of a @fa<loop_statement> with a @b<while>
@fa<iteration_scheme>, the @fa<condition> is evaluated before each execution
of the @fa<sequence_of_statements>; if the value of the @fa<condition> is True,
the @fa<sequence_of_statements> is executed; if False, the execution of the
@fa<loop_statement> is complete.
@dinst
If the reserved word @b<parallel> is present in the @fa<iteration_scheme> of
a @fa<loop_statement> (a
@i<parallel loop>), the iterations are partitioned into one or more
@i<chunks>, each with its own separate logical thread of control (see
clause 9). If a @fa<chunk_specification> is present in a parallel loop,
it is elaborated first, and the result of the elaboration determines the
maximum number of chunks used for the parallel loop. If the
@fa<chunk_specification> is an @i<integer_>@fa<simple_expression>, the
elaboration evaluates the expression, and the value of the expression
determines the maximum number of chunks. If a @fa<discrete_subtype_definition>
is present, the elaboration elaborates the @fa<discrete_subtype_definition>,
which defines the subtype of the chunk parameter, and the number of values in
this subtype determines the maximum number of chunks. After elaborating
the @fa<chunk_specification>, a check is made that the determined maximum
number of chunks is greater than zero. If this check fails,
Program_Error is raised.
!corrigendum 5.5(9/4)
!AI-0119-1
!AI-0250-1
!AI-0251-1
!AI-0266-1
!AI-0294-1
@drepl
For the execution of a @fa<loop_statement> with the @fa<iteration_scheme>
being @b<for> @fa<loop_parameter_specification>,
the @fa<loop_parameter_specification> is first elaborated. This
elaboration creates the loop parameter and elaborates the
@fa<discrete_subtype_definition>.
If the @fa<discrete_subtype_definition> defines a subtype with a null range,
the execution of the @fa<loop_statement> is complete. Otherwise, the
@fa<sequence_of_statements> is executed once for each value of the
discrete subtype defined by the @fa<discrete_subtype_definition> that
satisfies the predicates of the subtype (or until
the loop is left as a consequence of a transfer of control).
Prior to each such iteration,
the corresponding value of the discrete subtype is assigned to the
loop parameter. These values are assigned in increasing order unless
the reserved word @b<reverse> is present, in which case the values
are assigned in decreasing order.
@dby
For the execution of a @fa<loop_statement> that has an @fa<iteration_scheme>
including a @fa<loop_parameter_specification>, after elaborating the
@fa<chunk_specification>, if any, the @fa<loop_parameter_specification> is
elaborated. This elaborates the @fa<discrete_subtype_definition>,
which defines the subtype of the loop parameter. If the
@fa<discrete_subtype_definition> defines a subtype
with a null range, the execution of the @fa<loop_statement> is complete.
Otherwise, the @fa<sequence_of_statements> is conditionally executed once for
each value of
the discrete subtype defined by the @fa<discrete_subtype_definition> that
satisfies the predicates of the subtype (or until the loop is left as a
consequence of a transfer of control). Prior to each such iteration, the
corresponding value of the discrete subtype is assigned to the loop
parameter associated with the given iteration. If the loop is a parallel
loop, each chunk has its own logical thread of control with its own copy
of the loop parameter; otherwise (a @i<sequential loop>), a single logical
thread of control performs the loop, and there is a single copy of the
loop parameter. Each logical thread of control handles a distinct
subrange of the values of the subtype of the loop parameter such that
all values are covered with no overlaps. Within each logical thread of
control, the values are assigned to the loop parameter in increasing
order unless the reserved word @b<reverse> is present, in which case the
values are assigned in decreasing order.
If a @fa<chunk_specification> with a @fa<discrete_subtype_definition> is
present, then the logical thread of control associated with a given chunk
has its own copy of the chunk parameter initialized with a distinct value from
the discrete subtype defined by the @fa<discrete_subtype_definition>. The
values of the chunk parameters are assigned such that they increase with
increasing values of the ranges covered by the corresponding loop
parameters.
Whether or not a @fa<chunk_specification> is present in a parallel loop,
the total number of iterations of the loop represents an upper bound
on the number of logical threads of control devoted to the loop.
!corrigendum 5.5(9.1/4)
!AI-0250-1
!AI-0266-1
@drepl
For details about the execution of a @fa<loop_statement> with
the @fa<iteration_scheme> being @b<for> @fa<iterator_specification>,
see 5.5.2.
@dby
For details about the execution of a @fa<loop_statement> with
the @fa<iteration_scheme> including an @fa<iterator_specification>,
see 5.5.2. For details relating to a @fa<procedural_iterator>, see
5.5.3.
!corrigendum 5.5(21)
!AI-0119-1
!AI-0312-1
!AI-0386-1
@dinsa
@xcode<Summation:
@b<while> Next /= Head @b<loop> -- @ft<@i<see 3.10.1>>
Sum := Sum + Next.Value;
Next := Next.Succ;
@b<end loop> Summation;>
@dinss
@i<Example of a simple parallel loop:>
@xcode<-- @ft<@i<see 3.6>>
@b<parallel>
@b<for> I @b<in> Grid'Range(1) @b<loop>
Grid(I, 1) := (@b<for all> J @b<in> Grid'range(2) =@> Grid(I,J) = True);
@b<end loop>;>
@i<Example of a parallel loop with a chunk specification:>
@xcode<@b<declare>
@b<subtype> Chunk_Number @b<is> Natural @b<range> 1 .. 8;>
@xcode< Partial_Sum,
Partial_Max : @b<array> (Chunk_Number) @b<of> Natural := (@b<others> =@> 0);
Partial_Min : @b<array> (Chunk_Number) @b<of> Natural := (@b<others> =@> Natural'Last);>
@xcode<@b<begin>
@b<parallel> (Chunk @b<in> Chunk_Number)
@b<for> I @b<in> Grid'Range(1) @b<loop>
@b<declare>
True_Count : @b<constant> Natural :=
[@b<for> J @b<in> Grid'Range(2) =@> (@b<if> Grid (I, J) @b<then> 1 @b<else> 0)]'Reduce("+",0);
@b<begin>
Partial_Sum (Chunk) := @@ + True_Count;
Partial_Min (Chunk) := Natural'Min(@@, True_Count);
Partial_Max (Chunk) := Natural'Max(@@, True_Count);
@b<end>;
@b<end loop>;>
@xcode< Put_Line ("Total=" & Partial_Sum'Reduce("+", 0)'Image &
", Min=" & Partial_Min'Reduce(Natural'Min, Natural'Last)'Image &
", Max=" & Partial_Max'Reduce(Natural'Max, 0)'Image);
@b<end>;>
@i<For an example of an> @fa<iterator_filter>@i<, see 4.5.8.>
!corrigendum 5.5.2(2/3)
!AI-0156-1
!AI-0250-1
!AI-0266-1
@drepl
@xindent<@fa<iterator_specification>@fa<@ ::=@ >@hr
@ @ @ @ @fa<defining_identifier>@ @b<in>@ [@b<reverse>]@ @i<iterator_>@fa<name>@hr
@ @ |@ @fa<defining_identifier>@ [:@ @fa<subtype_indication>]@ @b<of>@ [@b<reverse>]@ @i<iterable_>@fa<name>>
@dby
@xindent<@fa<iterator_specification>@fa<@ ::=@ >@hr
@ @ @ @ @fa<defining_identifier>@ [:@ @fa<loop_parameter_subtype_indication>]@ @b<in>@ [@b<reverse>]@ @i<iterator_>@fa<name>@hr
@ @ @ @ @ @ [@fa<iterator_filter>]@hr
@ @ |@ @fa<defining_identifier>@ [:@ @fa<loop_parameter_subtype_indication>]@ @b<of> [@b<reverse>]@ @i<iterable_>@fa<name>@hr
@ @ @ @ @ @ [@fa<iterator_filter>]>
@xindent<@fa<loop_parameter_subtype_indication>@fa<@ ::=@ >@fa<subtype_indication>@ |@ @fa<access_definition>>
@xindent<If an @fa<iterator_specification> is for a parallel construct, the reserved word
@b<reverse> shall not appear in the @fa<iterator_specification>.>
!corrigendum 5.5.2(5/4)
!AI-0156-1
!AI-0183-1
@drepl
The subtype defined by the @fa<subtype_indication>, if any, of an array
component iterator shall statically match the component subtype of the type of
the @i<iterable_>@fa<name>. The subtype defined by the @fa<subtype_indication>,
if any, of a container element iterator shall statically match the default
element subtype for the type of the @i<iterable_>@fa<name>.
@dby
The subtype defined by the @fa<loop_parameter_subtype_indication>, if any, of a
generalized iterator shall statically match the iteration cursor subtype.
The subtype defined by the @fa<loop_parameter_subtype_indication>, if any, of an array
component iterator shall statically match the component subtype of the type of
the @i<iterable_>@fa<name>. The subtype defined by the @fa<loop_parameter_subtype_indication>,
if any, of a container element iterator shall statically match the default
element subtype for the type of the @i<iterable_>@fa<name>.
!corrigendum 5.5.2(10/3)
!AI-0250-1
!AI-0266-1
@drepl
For a generalized iterator, the loop parameter is created, the
@i<iterator_>@fa<name> is evaluated, and the denoted iterator object becomes
the @i<loop iterator>. In a forward generalized iterator, the operation
First of the iterator type is called on the loop iterator, to produce
the initial value for the loop parameter. If the result of calling
Has_Element on the initial value is False, then the execution of the
@fa<loop_statement> is complete. Otherwise, the @fa<sequence_of_statements>
is executed and then the Next operation of the iterator type is called with
the loop iterator and the current value of the loop parameter to produce the
next value to be assigned to the loop parameter. This repeats until
the result of calling Has_Element on the loop parameter is False,
or the loop is left as a consequence of a transfer of control. For a
reverse generalized iterator, the operations Last and Previous are
called rather than First and Next.
@dby
For a sequential generalized iterator, the loop parameter is created, the
@i<iterator_>@fa<name> is evaluated, and the denoted iterator object becomes
the @i<loop iterator>. In a forward generalized iterator, the operation
First of the iterator type is called on the loop iterator, to produce
the initial value for the loop parameter. If the result of calling
Has_Element on the initial value is False, then the execution of the
@fa<loop_statement> is complete. Otherwise, the @fa<sequence_of_statements>
is conditionally executed and then the Next operation of the iterator type is
called with the loop iterator and the current value of the loop parameter to
produce the next value to be assigned to the loop parameter. This repeats until
the result of calling Has_Element on the loop parameter is False,
or the loop is left as a consequence of a transfer of control. For a
reverse generalized iterator, the operations Last and Previous are
called rather than First and Next.
For a parallel generalized iterator, the @fa<chunk_specification>, if any, of
the associated parallel construct, is first elaborated, to determine the
maximum number of chunks (see 5.5), and then the operation Split_Into_Chunks
of the iterator type is called, with the determined maximum passed as the
Max_Chunks parameter, specifying the upper bound for the number of loop
parameter objects (and the number of logical threads of control) to be
associated with the iterator. In the absence of a @fa<chunk_specification>,
the maximum number of chunks is determined in an implementation-defined
manner.
Upon return from Split_Into_Chunks, the actual number of chunks for
the loop is determined by calling the Chunk_Count operation of the
iterator, at which point one logical thread of control is initiated
for each chunk, with an associated chunk index in the range from one
to the actual number of chunks. Within each logical thread of control,
a loop parameter is created. If a @fa<chunk_specification> with a
@fa<discrete_subtype_definition> is present in the associated parallel
construct, then a chunk parameter is created, and initialized with a
value from the discrete subtype defined by the
@fa<discrete_subtype_definition>, so that the order of the chosen chunk
parameter values correspond to the order of the chunk indices
associated with the logical threads of control. The operation First
of the iterator type having a Chunk parameter is called on the loop
iterator, with Chunk initialized from the corresponding chunk index,
to produce the initial value for the loop parameter. If the result of
calling Has_Element on this initial value is False, then the execution
of the logical thread of control is complete. Otherwise, the
@fa<sequence_of_statements> is conditionally executed and then the Next
operation of the iterator type having a Chunk parameter is called, with the
loop iterator, the current value of the loop parameter, and the
corresponding chunk index, to produce the next value to be assigned to
the loop parameter. This repeats until the result of calling
Has_Element on the loop parameter is False, or the associated parallel
construct is left as a consequence of a transfer of control. In the
absence of a transfer of control, the associated parallel construct of
a parallel generalized iterator is complete when all of its logical
threads of control are complete.
!corrigendum 5.5.2(11/3)
!AI-0250-1
!AI-0266-1
@drepl
For an array component iterator, the @i<iterable_>@fa<name> is evaluated and
the denoted array object becomes the @i<array for the
loop>. If the array for the loop is a null array, then the execution
of the @fa<loop_statement> is complete. Otherwise, the
@fa<sequence_of_statements> is executed with the loop parameter denoting
each component of the array for the loop, using a @i<canonical> order
of components, which is last dimension varying fastest (unless the
array has convention Fortran, in which case it is first dimension
varying fastest). For a forward array component iterator, the iteration
starts with the component whose index values are each the first in their
index range, and continues in the canonical order. For a reverse array
component iterator, the iteration starts with the component whose index
values are each the last in their index range, and continues in the reverse
of the canonical order. The loop iteration proceeds until the
@fa<sequence_of_statements> has been executed for each component of the
array for the loop, or until the loop is left as a consequence of a
transfer of control.
@dby
For an array component iterator, the @fa<chunk_specification> of the associated
parallel construct, if any, is first elaborated to determine the maximum number
of chunks (see 5.5), and then the @i<iterable_>@fa<name> is evaluated and
the denoted array object becomes the @i<array for the
loop>. If the array for the loop is a null array, then the execution
of the @fa<loop_statement> is complete. Otherwise, the
@fa<sequence_of_statements> is conditionally executed with the loop parameter
denoting
each component of the array for the loop, using a @i<canonical> order
of components, which is last dimension varying fastest (unless the
array has convention Fortran, in which case it is first dimension
varying fastest). For a forward array component iterator, the iteration
starts with the component whose index values are each the first in their
index range, and continues in the canonical order. For a reverse array
component iterator, the iteration starts with the component whose index
values are each the last in their index range, and continues in the reverse
of the canonical order. For a parallel array component iterator, the iteration
is broken up into contiguous chunks of the canonical order, such that all
components are covered with no overlaps; each chunk has its own logical thread
of control with its own loop parameter and iteration within each chunk is in
the canonical order. The number of chunks is implementation defined, but is
limited in the presence of a @fa<chunk_specification> to the determined
maximum. The loop iteration proceeds until the
@fa<sequence_of_statements> has been conditionally executed for each
component of the array for the loop, or until the loop is left as a
consequence of a transfer of control.
If a @fa<chunk_specification> with a @fa<discrete_subtype_definition> is
present in the associated parallel construct, then the logical thread of
control associated with a given chunk has a chunk parameter
initialized with a distinct value from the discrete subtype defined by
the @fa<discrete_subtype_definition>. The values of the chunk parameters
are assigned such that they increase in the canonical order of the
starting array components for the chunks.
!corrigendum 5.5.2(12/3)
!AI-0111-1
!AI-0266-1
@drepl
For a container element iterator, the @i<iterable_>@fa<name> is evaluated
and the denoted iterable container object becomes the @i<iterable
container object for the loop>. The default iterator function for the type of
the iterable container object for the loop is called on the iterable container object
and the result is the @i<loop iterator>. An object of the default
cursor subtype is created (the @i<loop cursor>).
@dby
For a container element iterator, the @fa<chunk_specification> of the associated
parallel construct, if any, is first elaborated to determine the maximum number
of chunks (see 5.5), and then the @i<iterable_>@fa<name> is evaluated.
If the container type has Iterator_View specified, an object of the
Iterator_View type is created with the discriminant referencing the
iterable container object denoted by the @i<iterable_>@fa<name>. This is
the @i<iterable container object for the loop>. Otherwise, the iterable
container object denoted by the @i<iterable_>@fa<name> becomes the iterable
container object for the loop. The default iterator function for the type of
the iterable container object for the loop is called on the iterable container object
and the result is the @i<loop iterator>. For a sequential container element
iterator, an object of the default cursor subtype is created (the @i<loop cursor>).
For a parallel container element iterator, each chunk of iterations
will have its own loop cursor, again of the default cursor subtype.
!corrigendum 5.5.3(0)
!AI-0189-1
!AI-0250-1
!AI-0292-1
!AI-0294-1
!AI-0308-1
!AI-0320-1
!AI-0326-2
!AI-0344-1
!AI-0374-1
@dinsc
A @fa<procedural_iterator> invokes a user-defined procedure, passing in the body of
the enclosing @fa<loop_statement> as a parameter of an anonymous access-to-procedure
type, to allow the loop body to be executed repeatedly as part of the invocation
of the user-defined procedure.
@s8<@i<Syntax>>
@xindent<@fa<procedural_iterator>@fa<@ ::=@ >@hr
@ @ @ @ @fa<iterator_parameter_specification>@ @b<of>@ @fa<iterator_procedure_call>@hr
@ @ @ @ @ @ [@fa<iterator_filter>]>
@xindent<@fa<iterator_parameter_specification>@fa<@ ::=@ >@hr
@ @ @ @ @fa<formal_part>@hr
@ @ |@ (@fa<defining_identifier>{,@ @fa<defining_identifier>})>
@xindent<@fa<iterator_procedure_call>@fa<@ ::=@ >@hr
@ @ @ @ @i<procedure_>@fa<name>@hr
@ @ |@ @i<procedure_>@fa<prefix>@ @fa<iterator_actual_parameter_part>>
@xindent<@fa<iterator_actual_parameter_part>@fa<@ ::=@ >@hr
@ @ @ @ (@fa<iterator_parameter_association>@ {,@ @fa<iterator_parameter_association>})>
@xindent<@fa<iterator_parameter_association>@fa<@ ::=@ >@hr
@ @ @ @ @fa<parameter_association>@hr
@ @ |@ @fa<parameter_association_with_box>>
@xindent<@fa<parameter_association_with_box>@fa<@ ::=@ >@hr
@ @ @ [@ @i<formal_parameter_>@fa<selector_name>@ =@>@ ]@ <@>>
At most one @fa<iterator_parameter_association> within an
@fa<iterator_actual_parameter_part> shall be a
@fa<parameter_association_with_box>.
@s8<@i<Name Resolution Rules>>
The @fa<name> or @fa<prefix> given in an @fa<iterator_procedure_call> shall
resolve to denote a callable entity @i<C> (the @i<iterating procedure>)
that is a procedure, or an entry renamed as (viewed as) a procedure. When
there is an @fa<iterator_actual_parameter_part>, the @fa<prefix>
can be an @fa<implicit_dereference> of an access-to-subprogram value.
An @fa<iterator_procedure_call> without a @fa<parameter_association_with_box>
is equivalent to one with an @fa<iterator_actual_parameter_part> with an
additional @fa<parameter_association_with_box> at the end, with the
@i<formal_parameter_>@fa<selector_name> identifying the last formal parameter of
the callable entity denoted by the @fa<name> or @fa<prefix>.
An @fa<iterator_procedure_call> shall contain at most one
@fa<iterator_parameter_association> for each formal parameter of the callable
entity @i<C>. Each formal parameter without an
@fa<iterator_parameter_association> shall have a @fa<default_expression> (in
the profile of the view of @i<C> denoted by the @fa<name> or @fa<prefix>).
The formal parameter of the callable entity @i<C> associated with the
@fa<parameter_association_with_box> shall be of an anonymous
access-to-procedure type @i<A>.
@s8<@i<Legality Rules>>
The anonymous access-to-procedure type @i<A> shall have at least one formal
parameter in its parameter profile. If the @fa<iterator_parameter_specification>
is a @fa<formal_part>, then this @fa<formal_part> shall be mode conformant
with that of @i<A>. If the @fa<iterator_parameter_specification> is a list of
@fa<defining_identifier>s, the number of formal parameters of @i<A> shall be the
same as the length of this list.
If the @fa<name> or @fa<prefix> given in an @fa<iterator_procedure_call>
denotes an abstract subprogram, the subprogram shall be a dispatching
subprogram.
@s8<@i<Static Semantics>>
A @fa<loop_statement> with an @fa<iteration_scheme> that has a
@fa<procedural_iterator> is equivalent to a local declaration of a procedure P
followed by a @fa<procedure_call_statement> that is formed from the
@fa<iterator_procedure_call> by replacing the <@> of the
@fa<parameter_association_with_box> with P'Access.
The @fa<formal_part> of the locally declared procedure P is formed from the
@fa<formal_part> of the anonymous access-to-procedure type @i<A>, by replacing
the @fa<identifier> of each formal parameter of this @fa<formal_part> with the
@fa<identifier> of the corresponding formal parameter or element of the list
of @fa<defining_identifier>s given in the @fa<iterator_parameter_specification>.
The body of @i<P> consists of the conditionally executed
@fa<sequence_of_statements>. The procedure P is called the @i<loop body procedure>.
In a procedural iterator, the Parallel_Calls aspect (see 9.10.1) of
the loop body procedure is True if the reserved word @b<parallel> occurs
in the corresponding loop statement, and False otherwise.
The following aspects may be specified for a callable entity @i<S> that
has exactly one formal parameter of an anonymous access-to-subprogram
type:
@xhang<@xterm<Allows_Exit>
The Allows_Exit aspect is of type Boolean. The specified value shall
be static. The Allows_Exit aspect of an inherited primitive subprogram is
True if Allows_Exit is True either for the corresponding subprogram
of the progenitor type or for any other inherited subprogram that it
overrides. If not specified or inherited as True, the Allows_Exit
aspect of a callable entity is False. For an entry, only a confirming
specification of False is permitted for the Allows_Exit aspect.>
@xindent<Specifying the Allows_Exit aspect to be True for a subprogram
indicates that the subprogram @i<allows exit>, meaning that it is prepared
to be completed by arbitrary transfers of control from the loop body
procedure, including propagation of exceptions. A subprogram for which
Allows_Exit is True should use finalization as appropriate rather
than exception handling to recover resources and make any necessary
final updates to data structures.>
@xhang<@xterm<Parallel_Iterator>
The Parallel_Iterator aspect is of type Boolean. The specified value
shall be static. The Parallel_Iterator aspect of an inherited
primitive subprogram is True if Parallel_Iterator is True either for
the corresponding subprogram of the progenitor type or for any other
inherited subprogram that it overrides. If not specified or inherited as
True, the Parallel_Iterator aspect of a callable entity is False.>
@xindent<Specifying the Parallel_Iterator aspect to be True for a callable
entity indicates that the entity might invoke the loop body
procedure from multiple distinct logical threads of control. The
Parallel_Iterator aspect for a subprogram shall be statically False
if the subprogram allows exit.>
@s8<@i<Legality Rules>>
If a callable entity overrides an inherited dispatching subprogram that
allows exit, the overriding callable entity also shall allow exit. If a
callable entity overrides an inherited dispatching subprogram that has a
True Parallel_Iterator aspect, the overriding callable entity also shall
have a True Parallel_Iterator aspect.
A @fa<loop_statement> with a @fa<procedural_iterator> as its
@fa<iteration_scheme> shall begin with the reserved word @b<parallel> if
and only if the callable entity identified in the @fa<iterator_procedure_call>
has a Parallel_iterator aspect of True.
If the actual parameter of an anonymous access-to-subprogram type,
passed in an explicit call of a subprogram for which the
Parallel_Iterator aspect is True, is of the form @i<P>'Access, the
designated subprogram @i<P> shall have a Parallel_Calls aspect True (see
9.10.1).
The @fa<sequence_of_statements> of a @fa<loop_statement> with a
@fa<procedural_iterator> as its @fa<iteration_scheme> shall contain an
@fa<exit_statement>, return statement, @fa<goto_statement>, or
@fa<requeue_statement> that leaves the loop only if the callable entity
associated with the @fa<procedural_iterator> allows exit.
The @fa<sequence_of_statements> of a @fa<loop_statement> with a
@fa<procedural_iterator> as its @fa<iteration_scheme> shall not contain
an @fa<accept_statement> whose @fa<entry_declaration> occurs outside the
@fa<loop_statement>.
@s8<@i<Dynamic Semantics>>
For the execution of a @fa<loop_statement> with an @fa<iteration_scheme> that
has a @fa<procedural_iterator>, the procedure denoted by the @fa<name> or
@fa<prefix> of the @fa<iterator_procedure_call> (the @i<iterating procedure>)
is invoked, passing an access value designating the loop body procedure as a
parameter. The iterating procedure then calls the loop body procedure zero or
more times and returns, whereupon the @fa<loop_statement> is complete. If the
@b<parallel> reserved word is present, the iterating procedure might invoke
the loop body procedure from multiple distinct logical threads of control.
@s8<@i<Bounded (Run-Time) Errors>>
If the callable entity identified in the @fa<iterator_procedure_call> allows
exit, then it is a bounded error for a call of the loop body procedure
to be performed from within an abort-deferred operation (see 9.8),
unless the entire @fa<loop_statement> was within the same abort-deferred
operation. If detected, Program_Error is raised at the point of the
call; otherwise, a transfer of control from the @fa<sequence_of_statements>
of the @fa<loop_statement> might not terminate the @fa<loop_statement>, and
the loop body procedure might be called again.
If a @fa<loop_statement> with the @fa<procedural_iterator> as its
@fa<iteration_scheme> (see 5.5) does not begin with the reserved word
@b<parallel>, it is a bounded error if the loop body procedure is invoked
from a different logical thread of control than the one that initiates
the @fa<loop_statement>. If detected, Program_Error is raised; otherwise,
conflicts associated with concurrent executions of the loop body
procedure can occur without being detected by the applicable conflict
check policy (see 9.10.1). Furthermore, propagating an exception or
making an attempt to exit in the presence of multiple threads of
control might not terminate the @fa<loop_statement>, deadlock might occur,
or the loop body procedure might be called again.
@s8<@i<Examples>>
Example of iterating over a map from My_Key_Type to My_Element_Type (see
A.18.4):
@xcode<@b<for> (C : Cursor) @b<of> My_Map.Iterate @b<loop>
Put_Line (My_Key_Type'Image (Key (C)) & " =@> " &
My_Element_Type'Image (Element (C)));
@b<end loop>;>
@xcode<--@ft<@i< The above is equivalent to:>>>
@xcode<@b<declare>
@b<procedure> P (C : Cursor) @b<is>
@b<begin>
Put_Line (My_Key_Type'Image (Key (c)) & " =@> " &
My_Element_Type'Image (Element (C)));
@b<end> P;
@b<begin>
My_Map.Iterate (P'access);
@b<end>;>
Example of iterating over the environment variables (see A.17):
@xcode<@b<for> (Name, Val) @b<of> Ada.Environment_Variables.Iterate(<@>) @b<loop>
--@ft<@i< "(<@>)" is optional because it is the last parameter>>
Put_Line (Name & " =@> " & Val);
@b<end loop>;>
@xcode<--@ft<@i< The above is equivalent to:>>>
@xcode<@b<declare>
@b<procedure> P (Name : String; Val : String) @b<is>
@b<begin>
Put_Line (Name & " =@> " & Val);
@b<end> P;
@b<begin>
Ada.Environment_Variables.Iterate (P'access);
@b<end>;>
!corrigendum 6.1.1(1/4)
!AI-0220-1
!AI-0272-1
@drepl
For a noninstance subprogram, a generic subprogram, or an entry, the
following language-defined aspects may be specified with
an @fa<aspect_specification> (see 13.1.1):
@dby
For a noninstance subprogram (including a generic formal subprogram), a
generic subprogram, an entry, or an access-to-subprogram type, the
following language-defined aspects may be specified with
an @fa<aspect_specification> (see 13.1.1):
!corrigendum 6.1.1(22.1/4)
!AI-0198-1
!AI-0280-2
@drepl
@xbullet<a @fa<predicate> of a @fa<quantified_expression>;>
@dby
@xbullet<a name statically denoting a
full constant declaration of a type for which all views are constant (see
3.3);>
@xbullet<a name statically denoting a nonaliased @b<in> parameter of an
elementary type;>
@xbullet<an Old @fa<attribute_reference>;>
@xbullet<an invocation of a predefined operator where all of the operands are
known on entry;>
@xbullet<a function call where the function has aspect Global =@> @b<null>
where all of the actual parameters are known on entry;>
@xbullet<a @fa<selected_component> of a known-on-entry @fa<prefix>;>
@xbullet<an @fa<indexed_component> of a known-on-entry @fa<prefix> where all
index @fa<expression>s are known on entry;>
@xbullet<a parenthesized known-on-entry @fa<expression>;>
@xbullet<a @fa<qualified_expression> or @fa<type_conversion> whose operand is
a known-on-entry expression;>
@xbullet<a @fa<conditional_expression> where all of the @fa<condition>s,
@i<selecting_>@fa<expression>s, and
@i<dependent_>@fa<expression>s are known on entry.>
A subexpression of a postcondition expression is @i<unconditionally
evaluated>, conditionally evaluated, or @i<repeatedly evaluated>.
The following subexpressions are repeatedly evaluated:
@xbullet<A subexpression of a predicate of a @fa<quantified_expression>;>
@xbullet<A subexpression of the expression of an @fa<array_component_association>;>
@xbullet<A subexpression of the expression of a @fa<container_element_association>.>
If a subexpression is not repeatedly evaluated, and not evaluated
unconditionally, then it is @i<conditionally evaluated>, and there is a
set of @i<determining expressions> that determine whether the
subexpression is actually evaluated at run time. Such subexpressions
and their determining expressions are as follows:
@xbullet<For an @fa<if_expression> that is not repeatedly evaluated, a
subexpression of any part other than the first condition is
conditionally evaluated, and its determining expressions include all
@fa<condition>s of the @fa<if_expression> that precede the subexpression
textually;>
@xbullet<For a @fa<case_expression> that is not repeatedly evaluated, a
subexpression of any @i<dependent_>@fa<expression> is conditionally
evaluated, and its determining expressions include the
@i<selecting_>@fa<expression> of the @fa<case_expression>;>
!corrigendum 6.1.1(24/3)
!AI-0217-1
!AI-0280-2
!AI-0368-2
@drepl
@xbullet<a @fa<membership_choice> other than the first of a membership
operation.>
@dby
@xbullet<For a membership test that is not repeatedly evaluated, a
subexpression of a @fa<membership_choice> other than the first is
conditionally evaluated, and its determining expressions include the
@i<tested_>@fa<simple_expression> and the preceding
@fa<membership_choice>s of the
membership test.>
A conditionally evaluated subexpression is @i<determined to be
unevaluated> at run time if its set of determining expressions are all
known on entry, and when evaluated on entry their values are such that
the given subexpression is not evaluated.
!corrigendum 6.1.1(27/3)
!AI-0217-1
!AI-0280-2
@drepl
@xindent<Reference to this attribute is only allowed within a postcondition
expression. The @fa<prefix> of an Old @fa<attribute_reference> shall not
contain a Result @fa<attribute_reference>, nor an Old
@fa<attribute_reference>, nor a use of an entity declared within the
postcondition expression but not within @fa<prefix> itself (for example,
the loop parameter of an enclosing @fa<quantified_expression>). The @fa<prefix>
of an Old @fa<attribute_reference> that is potentially unevaluated shall
statically denote an entity.>
@dby
@xindent<Reference to this attribute is only allowed within a postcondition
expression. The @fa<prefix> of an Old @fa<attribute_reference> shall not
contain a Result @fa<attribute_reference>, nor an Old
@fa<attribute_reference>, nor a use of an entity declared within the
postcondition expression but not within @fa<prefix> itself (for example,
the loop parameter of an enclosing @fa<quantified_expression>). The @fa<prefix>
of an Old @fa<attribute_reference> shall
statically name (see 4.9) an entity, unless the @fa<attribute_reference> is
unconditionally evaluated, or is conditionally evaluated where all of
the determining expressions are known on entry.>
!corrigendum 6.1.1(29/4)
!AI-0185-1
!AI-0220-1
@drepl
@xhang<@xterm<F'Result>Within
a postcondition expression for function F, denotes
the result object of the function. The type of this attribute is that
of the function result except within a Post'Class postcondition
expression for a function with a controlling result or with a
controlling access result. For a controlling result, the type of the
attribute is @i<T>'Class, where @i<T> is the function result type. For a
controlling access result, the type of the attribute is an anonymous
access type whose designated type is @i<T>'Class, where @i<T> is the
designated type of the function result type.>
@dby
@xhang<@xterm<F'Result>Within
a postcondition expression for F, denotes the return object of the
function call for which the postcondition expression is evaluated.
The type of this attribute is that of the result subtype of the
function or access-to-function type except within a Post'Class
postcondition expression for a function with a controlling result or with a
controlling access result; in those cases the type of the attribute was
described previously.>
!corrigendum 6.1.1(39/3)
!AI-0220-1
!AI-0272-1
!AI-0280-2
!AI-0373-1
@drepl
For a call via an access-to-subprogram value, all precondition and
postcondition checks performed are determined by the subprogram or entry
denoted by the prefix of the Access attribute reference that produced the
value.
@dby
For a call via an access-to-subprogram value, precondition and postcondition
checks performed are as determined by the subprogram or entry denoted by the
prefix of the Access attribute reference that produced the value. In addition,
a precondition check of any precondition expression associated with the
access-to-subprogram type is performed. Similarly, a postcondition check of
any postcondition expression associated with the access-to-subprogram type is
performed.
For a call on a generic formal subprogram, precondition and
postcondition checks performed are as determined by the subprogram or entry
denoted by the actual subprogram, along with any specific precondition
and specific postcondition of the formal subprogram itself.
@s8<@i<Implementation Permissions>>
An implementation may evaluate a known-on-entry subexpression of a
postcondition expression of an entity at the place where X'Old
constants are created for the entity, with the normal evaluation of
the postcondition expression, or both.
!corrigendum 6.1.2(0)
!AI-0079-3
!AI-0375-1
@dinsc
For a subprogram, an entry, a named access-to-subprogram type, a task
unit, a protected unit, or a library package or generic library package,
the following language-defined aspect may be specified
with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Global>The syntax for the @fa<aspect_definition> used to
define a Global aspect is as follows:>
@xindent<@fa<global_aspect_definition>@fa<@ ::=@ >@hr
@ @ @ @ @b<null>@hr
@ @ |@ Unspecified@hr
@ @ |@ @fa<global_mode> @fa<global_designator>@hr
@ @ |@ (@fa<global_aspect_element>{, @fa<global_aspect_element>})@hr
@ @ |@ @fa<extended_global_aspect_definition>>
@xindent<@fa<global_aspect_element>@fa<@ ::=@ >@hr
@ @ @ @ @fa<global_mode> @fa<global_set>@hr
@ @ |@ @fa<extended_global_aspect_element>>
@xindent<@fa<global_mode>@fa<@ ::=@ >@hr
@ @ @ @ @fa<basic_global_mode>@hr
@ @ |@ @fa<extended_global_mode>>
@xindent<@fa<basic_global_mode>@fa<@ ::=@ >@b<in> | @b<in out> | @b<out>>
@xindent<@fa<global_set>@fa<@ ::=@ >@fa<global_name> {, @fa<global_name>}>
@xindent<@fa<global_designator>@fa<@ ::=@ >@b<all> | @b<synchronized> | @fa<global_name>>
@xindent<@fa<global_name>@fa<@ ::=@ >@i<object_>@fa<name> | @i<package_>@fa<name>>
@xindent<The Global aspect identifies the set of variables (which, for the
purposes of this clause includes all constants with some part being immutably
limited, or of a controlled type, private type, or private extension) that
are global to a callable entity or task body, and that are read or updated as
part of the execution of the callable entity or task body. If specified for
a protected unit, it refers to all of the protected operations of the
protected unit. Constants of any type may also be mentioned in a Global
aspect.>
@xindent<If not specified or otherwise defined below, the aspect defaults to
the Global aspect for the enclosing library unit if the entity is declared at
library level, and to Unspecified otherwise. If not specified for a library
unit, the aspect defaults to @fc<Global =@> @b<null>> for a library unit that
is declared Pure, and to @fc<Global =@> Unspecified> otherwise.>
For a dispatching subprogram, the following language-defined
aspect may be specified with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Global'Class>The syntax for the @fa<aspect_definition> used to
define a Global'Class aspect is the same as that defined above for
@fa<global_aspect_definition>. This aspect identifies an upper bound on the
set of variables global to a dispatching operation that can be read
or updated as a result of a dispatching call on the operation. If not
specified, the aspect defaults to the Global aspect for the
dispatching subprogram.>
@s8<@i<Name Resolution Rules>>
A @fa<global_name> shall resolve to statically denote an object or a
package (including a limited view of a package).
@s8<@i<Static Semantics>>
A @fa<global_aspect_definition> defines the Global or Global'Class aspect of
some entity. The Global aspect identifies the sets of global variables
that can be read, written, or modified as a side effect of executing the
operation(s) associated with the entity. The Global'Class aspect
associated with a dispatching operation of type @i<T> represents a
restriction on the Global aspect on a corresponding operation of any
descendant of type @i<T>.
The Global aspect for a callable entity defines the global variables
that might be referenced as part of a call on the entity, including any
assertion expressions that might be evaluated as part of the call,
including preconditions, postconditions, predicates, and type
invariants.
The Global aspect for an access-to-subprogram object (or subtype)
identifies the global variables that might be referenced when calling
via the object (or any object of that subtype) including assertion
expressions that apply.
For a predefined operator of an elementary type, or the function
representing an enumeration literal, the Global aspect is @b<null>. For a
predefined operator of a composite type, the Global aspect of the
operator defaults to that of the enclosing library unit (unless a Global
aspect is specified for the type @emdash see H.7).
The following is defined in terms of operations; the rules apply to all
of the above kinds of entities.
The global variables associated with any @fa<global_mode> can be read as a
side effect of an operation. The @b<in out> and @b<out> @fa<global_mode>s
together identify the set of global variables that can be updated as a side
effect of an operation. Creating an access-to-variable value that
designates an object is considered an update of the designated object,
and creating an access-to-constant value that designates an object is
considered a read of the designated object.
The overall set of objects associated with each @fa<global_mode> includes all
objects identified for the mode in the @fa<global_aspect_definition>.
A @fa<global_set> identifies a @i<global variable set> as follows:
@xbullet<@b<all> identifies the set of all global variables;>
@xbullet<@b<synchronized> identifies the set of all synchronized variables
(see 9.10), as well as variables of a composite type all of whose
non-discriminant subcomponents are synchronized;>
@xbullet<@fa<global_name>{, @fa<global_name>} identifies the union of the
sets of variables identified by the @fa<global_name>s in the list,
for the following forms of @fa<global_name>:>
@xinbull<@i<object_>@fa<name> identifies the specified global variable (or
constant);>
@xinbull<@i<package_>@fa<name> identifies the set of all variables declared
in the private part or body of the package, or anywhere within a private
descendant of the package.>
@s8<@i<Legality Rules>>
Within a @fa<global_aspect_definition>, a given @fa<global_mode> shall be
specified at most once. Similarly, within a @fa<global_aspect_definition>, a
given entity shall be named at most once by a @fa<global_name>.
If an entity (other than a library package or generic library package)
has a Global aspect other than Unspecified or @b<in out all>, then the
associated operation(s) shall read only those variables global to the
entity that are within the global variable set associated with the @b<in>,
@b<in out>, or @b<out> @fa<global_mode>s, and the operation(s) shall update
only those variables global to the entity that are within the global variable
set associated with either the @b<in out> or @b<out> @fa<global_mode>s. In
the absence of the No_Hidden_Indirect_Globals restriction (see H.4),
this ignores objects reached via a dereference of an access value. The
above rule includes any possible Global effects of calls occurring
during the execution of the operation, except for the following excluded
calls:
@xbullet<calls to formal subprograms;>
@xbullet<calls associated with operations on formal subtypes;>
@xbullet<calls through formal objects of an access-to-subprogram type;>
@xbullet<calls through access-to-subprogram parameters;>
@xbullet<calls on operations with Global aspect Unspecified.>
The possible Global effects of these excluded calls (other than those
that are Unspecified) are taken into account by the caller of the
original operation, by presuming they occur at least once during its
execution. For calls that are not excluded, the possible Global effects
of the call are those permitted by the Global aspect of the associated
entity, or by its Global'Class aspect if a dispatching call.
If a Global aspect other than Unspecified or @b<in out all> applies to an
access-to-subprogram type, then the @fa<prefix> of an Access @fa<attribute_reference>
producing a value of such a type shall denote a subprogram whose Global
aspect is not Unspecified and is @i<covered> by that of the result type, where
a global aspect @i<G1> is @i<covered> by a global aspect @i<G2> if the set of
variables that @i<G1> identifies as readable or updatable is a subset of the
corresponding set for @i<G2>. Similarly on a conversion to such a type, the
operand shall be of a named access-to-subprogram type whose Global aspect is
covered by that of the target type.
For a subprogram that is a dispatching operation of a tagged type @i<T>,
each mode of its Global aspect shall identify a subset of the variables
identified by the corresponding mode, or by the @b<in out> mode, of the
Global'Class aspect of a corresponding dispatching subprogram of any
ancestor of @i<T>, unless the aspect of that ancestor is Unspecified.
@s8<@i<Implementation Permissions>>
Implementations need not require that references to a constant object
that are considered variables in the above rules, be accounted for by
the Global or Global'Class aspect, if the implementation can determine
that the constant object is immutable.
Implementations may perform additional checks on calls to operations
with an Unspecified Global aspect to ensure that they do not violate any
limitations associated with the point of call.
Implementations may extend the syntax or semantics of the Global aspect in
an implementation-defined manner; for example, supporting additional
@fa<global_mode>s.
@s9<NOTES@hr
For an example of the use of these aspects and attributes, see the Vector
container definition in A.18.2.>
!corrigendum 6.2(10/4)
!AI-0236-1
!AI-0317-1
@drepl
A parameter of a by-reference type is passed by reference, as is an explicitly
aliased parameter of any type. Each value of a by-reference type has an associated
object. For a parenthesized expression, @fa<qualified_expression>,
or view conversion, this object is the one associated with the
operand. For a value conversion, the associated object is the anonymous result
object if such an object is created (see 4.6); otherwise it is the
associated object of the operand. For a @fa<conditional_expression>, this object
is the one associated with the evaluated @i<dependent_>@fa<expression>.
@dby
A parameter of a by-reference type is passed by reference, as is an explicitly
aliased parameter of any type. Each value of a by-reference type has an associated
object. For a value conversion, the associated object is the anonymous result
object if such an object is created (see 4.6); otherwise it is the
associated object of the operand. In
other cases, the object associated with the evaluated operative constituent of
the @fa<name> or @fa<expression> (see 4.4) determines its associated object.
!corrigendum 6.4.1(6.17/3)
!AI-0216-1
!AI-0324-1
@drepl
@xbullet<For each @fa<name> @i<N> that is passed as a parameter of mode
@b<in out> or @b<out> to the call @i<C>, there is no other @fa<name> among the
other parameters of mode @b<in out> or @b<out> to @i<C> that is known to
denote the same object.>
@dby
@xbullet<For each @fa<name> @i<N> denoting an object of an elementary type
that is passed as a parameter of mode @b<in out> or @b<out> to the call @i<C>,
there is no other @fa<name> among the other parameters of mode @b<in out> or
@b<out> to @i<C> that is known to denote the same object.>
!corrigendum 6.8(5/4)
!AI-0075-1
!AI-0191-1
@dinsa
If the result subtype has one or more unconstrained access discriminants, the
accessibility level of the anonymous access type of each access discriminant,
as determined by the @fa<expression> or @fa<aggregate> of the
@fa<expression_function_declaration>, shall not be statically deeper
than that of the master that elaborated the @fa<expression_function_declaration>.
@dinss
Aspect Static shall be specified to have the value True only if the
associated @fa<expression_function_declaration>:
@xbullet<is not a completion;>
@xbullet<has an @fa<expression> that is a potentially static expression;>
@xbullet<contains no calls to itself;>
@xbullet<each parameter (if any) is of mode @b<in> and is of a static subtype;>
@xbullet<has a result subtype that is a static subtype;>
@xbullet<has no applicable precondition or postcondition expression; and>
@xbullet<for result type @i<R>, if the function is a boundary entity for type
@i<R> (see 7.3.2), no type invariant applies to type @i<R>; if @i<R> has a
component type @i<C>, a similar rule applies to @i<C>.>
!corrigendum 7.3.2(8/3)
!AI-0075-1
!AI-0191-1
!AI-0199-1
@drepl
If the Type_Invariant'Class aspect is specified for a tagged type @i<T>,
then the invariant expression applies to all descendants of @i<T>.
@dby
If the Type_Invariant'Class aspect is specified for a tagged type @i<T>,
then a @i<corresponding expression> also applies to each nonabstract
descendant @i<T1> of @i<T> (including @i<T> itself if it is nonabstract).
The corresponding expression is constructed from the associated expression
as follows:
@xbullet<References to nondiscriminant components of @i<T> (or to @i<T>
itself) are replaced with references to the corresponding components of @i<T1>
(or to @i<T1> as a whole).>
@xbullet<References to discriminants of @i<T> are replaced with references to
the corresponding discriminant of @i<T1>, or to the specified value for the
discriminant, if the discriminant is specified by the
@fa<derived_type_definition> for some type that is an ancestor of @i<T1> and
a descendant of @i<T> (see 3.7).>
For a nonabstract type @i<T>, a callable entity is said to be a
@i<boundary entity>
for @i<T> if it is declared within the immediate scope of @i<T> (or by an
instance of a generic unit, and the generic is declared within the immediate
scope of type @i<T>), or is the Read or Input stream-oriented attribute of type
@i<T>, and either:
@xbullet<@i<T> is a private type or a private extension and the callable
entity is visible outside the immediate scope of type T or overrides an
inherited operation that is visible outside the immediate scope of @i<T>; or>
@xbullet<@i<T> is a record extension, and the callable entity is a primitive
operation visible outside the immediate scope of type @i<T> or overrides an
inherited operation that is visible outside the immediate scope of @i<T>.>
!corrigendum 7.3.2(15/4)
!AI-0075-1
!AI-0191-1
!AI-0193-1
@drepl
@xbullet<After a successful call on the Read or Input stream attribute of
the type @i<T>, the check is performed on the object initialized by the
stream attribute;>
@dby
@xbullet<Upon successful return from a call on any callable entity which is
a boundary entity for @i<T>, an invariant check is performed on each object
which is subject to an invariant check for @i<T>. In the case of a call to a
protected operation, the check is
performed before the end of the protected action. In the case of a call
to a task entry, the check is performed before the end of the rendezvous.
The following objects of a callable entity are subject to an invariant check
for @i<T>:>
@xinbull<a result with a nominal type that has a part of type @i<T>;>
!corrigendum 7.3.2(17/4)
!AI-0075-1
!AI-0191-1
@drepl
@xinbull<is declared within the immediate scope of type @i<T> (or by an
instance of a generic unit, and the generic is declared within the
immediate scope of type @i<T>),>
@dby
@xinbull<an @i<out> or @i<in out> parameter whose nominal type
has a part of type @i<T>;>
@xinbull<an access-to-object parameter or result whose designated nominal
type has a part of type @i<T>; or>
!corrigendum 7.3.2(19/3)
!AI-0075-1
!AI-0191-1
@drepl
@xinbull<has a result with a part of type @i<T>, or one or more
parameters with a part of type @i<T>, or an access to variable
parameter whose designated type has a part of type @i<T>.>
@dby
@xinbull<for a procedure or entry, an @b<in> parameter whose nominal type
has a part of type @i<T>.>
!corrigendum 7.3.2(20/3)
!AI-0075-1
!AI-0193-1
!AI-0338-1
@drepl
The check is performed on each such part of type @i<T>.
@dby
If the nominal type of a formal parameter (or the designated nominal type of
an access-to-object parameter or result) is incomplete at the point of the
declaration of the callable entity, and if the completion of that incomplete
type does not occur in the same declaration list as the incomplete declaration,
then for purposes of the preceding rules the nominal type is considered to
have no parts of type @i<T>.
!corrigendum 7.3.3(0)
!AI-0265-1
!AI-0272-1
!AI-0324-1
!AI-0332-1
@dinsc
For a private type or private extension (including a generic formal type),
the following language-defined aspect
may be specified with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Default_Initial_Condition>This aspect shall be specified by an
@fa<expression>, called a @i<default initial condition expression>.
Default_Initial_Condition may be specified on a
@fa<private_type_declaration>, a @fa<private_extension_declaration>, a
@fa<formal_private_type_definition>, or a @fa<formal_derived_type_definition>.>
@s8<@i<Name Resolution Rules>>
The expected type for a default initial condition expression is any
boolean type.
@s8<@i<Legality Rules>>
The Default_Initial_Condition aspect shall not be specified for
a type whose partial view has unknown
discriminants, whether explicitly declared or inherited.
@s8<@i<Static Semantics>>
If the Default_Initial_Condition aspect is specified for a type T, then
the default initial condition expression applies to T and to all
descendants of T.
@s8<@i<Dynamic Semantics>>
If one or more default initial condition expressions apply to a
type T, then a default initial condition check is performed
after successful initialization of an object of type T by default
(see 3.3.1). In the case of a controlled type, the check
is performed after the call to the type's Initialize procedure
(see 7.6).
If performing checks is required by the Default_Initial_Condition
assertion policy (see 11.4.2) in effect at the point of the
corresponding @fa<aspect_specification> applicable to a given type, then
the respective default initial condition expression is
considered enabled.
The default initial condition check consists of the evaluation of
each enabled default initial condition expression that applies to T.
These evaluations, if there are more than one, are performed in an
arbitrary order. If any of these evaluate to False,
Assertions.Assertion_Error is raised at the point of the object
initialization.
For a generic formal type T, default initial condition checks
performed are as determined by the actual type, along with any default initial
condition of the formal type itself.
@s8<@i<Implementation Permissions>>
Implementations may extend the syntax or semantics of the
Default_Initial_Condition aspect in an implementation-defined manner.
@s9<NOTES@hr
For an example of the use of this aspect, see the Vector container definition
in A.18.2.>
!corrigendum 7.3.4(0)
!AI-0187-1
!AI-0272-1
!AI-0285-1
!AI-0324-1
@dinsc
Certain characteristics of an object of a given type are unchanged by
most of the primitive operations of the type. Such characteristics are called
@i<stable properties> of the type.
@s8<@i<Static Semantics>>
A @i<property function> of type @i<T> is a function with a single parameter of
type @i<T> or of a class-wide type that covers @i<T>.
A @i<type property aspect definition> is a list of @fa<name>s written in the
syntax of a @fa<positional_array_aggregate>. A @i<subprogram property aspect
definition> is a list of @fa<name>s preceded by an optional @b<not>, also written
in the syntax of a @fa<positional_array_aggregate>.
For a nonformal private type, nonformal private extension, or full type that
does not have a partial view, the following language-defined aspects may be
specified with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Stable_Properties>This aspect
shall be specified by a type property aspect definition; each
@fa<name> shall statically denote a single property function of the type. This
aspect defines the @i<stable property functions> of the associated type.>
@xhang<@xterm<Stable_Properties'Class>This aspect
shall be specified by a type property aspect definition; each
@fa<name> shall statically denote a single property function of the type. This
aspect defines the @i<class-wide stable property functions> of the associated type.
Unlike most class-wide aspects, Stable_Properties'Class is not
inherited by descendant types and subprograms, but the enhanced class-wide
postconditions are inherited in the normal manner.>
For a primitive subprogram, the following language-defined aspects may be
specified with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Stable_Properties>This aspect
shall be specified by a subprogram property aspect definition;
each @fa<name> shall statically denote a single property function of a type for
which the associated subprogram is primitive.>
@xhang<@xterm<Stable_Properties'Class>This aspect
shall be specified by a subprogram property aspect definition;
each @fa<name> shall statically denote a single property function of a tagged
type for which the associated subprogram is primitive. Unlike most
class-wide aspects, Stable_Properties'Class is not inherited by descendant
subprograms, but the enhanced class-wide postconditions are inherited in
the normal manner.>
@s8<@i<Legality Rules>>
A stable property function of a type @i<T> (including a class-wide stable property
function) shall have a nonlimited return type and shall be:
@xbullet<a primitive function with a single parameter of mode @b<in> of
type @i<T>; or>
@xbullet<a function that is declared immediately within the declarative region
in which an ancestor type of @i<T> is declared and has a single parameter of
mode @b<in> of a class-wide type that covers @i<T>.>
In a subprogram property aspect definition for a subprogram @i<S>:
@xbullet<all or none of the items shall be preceded by @b<not>;>
@xbullet<any property functions mentioned after @b<not> shall be a stable
property function of a type for which @i<S> is primitive.>
@s8<@i<Static Semantics>>
For a primitive subprogram @i<S> of a type @i<T>, the stable property functions
of @i<S> for type @i<T> are:
@xbullet<if @i<S> has an aspect Stable_Properties specified that does not
include @b<not>, those functions denoted in the aspect Stable_Properties for
@i<S> that have a parameter of @i<T> or @i<T>'Class;>
@xbullet<if @i<S> has an aspect Stable_Properties specified that includes
@b<not>, those functions denoted in the aspect Stable_Properties for @i<T>,
excluding those denoted in the aspect Stable_Properties for @i<S>;>
@xbullet<if @i<S> does not have an aspect Stable_Properties, those functions
denoted in the aspect Stable_Properties for @i<T>, if any.>
A similar definition applies for class-wide stable property functions by
replacing aspect Stable_Properties with aspect Stable_Properties'Class
in the above definition.
The @i<explicit> specific postcondition expression for a subprogram @i<S>
is the @fa<expression> directly specified for @i<S> with the Post aspect.
Similarly, the @i<explicit> class-wide postcondition expression for a
subprogram @i<S> is the @fa<expression> directly specified for @i<S> with the
Post'Class aspect.
For every primitive subprogram @i<S> of a type @i<T>
that is not a stable property function of @i<T>, the specific postcondition
expression of @i<S> is modified to include expressions of the form
@fc<@i<F>(@i<P>) = @i<F>(@i<P>)'Old>, all @b<and>ed with each other
and any explicit specific postcondition expression, with one such equality
included for each stable property function @i<F> of @i<S> for type @i<T> that
does not occur in the explicit
specific postcondition expression of @i<S>, and @i<P> is each parameter of
@i<S> that has type @i<T>. The resulting specific postcondition expression of
@i<S> is used in place of the explicit specific postcondition expression of
@i<S> when interpreting the meaning of the postcondition as defined in 6.1.1.
For every primitive subprogram @i<S> of a type @i<T>
that is not a stable property function of @i<T>, the class-wide postcondition
expression of @i<S> is modified to include expressions of the form
@fc<@i<F>(@i<P>) = @i<F>(@i<P>)'Old>, all @b<and>ed with each other and any
explicit class-wide postcondition expression, with one such equality included
for each class-wide stable property function @i<F> of @i<S> for type @i<T>
that does not occur in any
class-wide postcondition expression that applies to @i<S>, and @i<P> is each
parameter of @i<S> that has type @i<T>. The resulting class-wide postcondition
expression of @i<S> is used in place of the explicit class-wide postcondition
expression of @i<S> when interpreting the meaning of the
postcondition as defined in 6.1.1.
@xindent<@s9<NOTES@hr
14 For an example of the use of these aspects, see the Vector container
definition in A.18.2.>>
!corrigendum 7.5(2.1/3)
!AI-0172-1
!AI-0236-1
!AI-0317-1
@drepl
In the following contexts, an @fa<expression> of a limited type is not permitted
unless it is an @fa<aggregate>, a @fa<function_call>, a parenthesized
@fa<expression> or @fa<qualified_expression> whose operand is permitted by this
rule, or a @fa<conditional_expression> all of whose
@i<dependent_>@fa<expression>s are permitted by this rule:
@dby
In the following contexts, an @fa<expression> of a limited type is permitted
only if each of its operative constituents is newly constructed (see 4.4):
!corrigendum 8.1(2.1/4)
!AI-0061-1
!AI-0236-1
!AI-0308-1
@dinsa
@xbullet<an @fa<access_definition>;>
@dinss
@xbullet<an @fa<iterated_component_association>;>
@xbullet<an @fa<iterated_element_association>;>
@xbullet<a @fa<quantified_expression>;>
@xbullet<a @fa<declare_expression>;>
!corrigendum 9(1/3)
!AI-0119-1
!AI-0330-1
@drepl
The execution of an Ada program consists of the execution of one or more
@i<tasks>. Each task represents a separate thread of control that proceeds
independently and concurrently between the points where it @i<interacts> with
other tasks. The various forms of task interaction are described in this clause,
and include:
@dby
The execution of an Ada program consists of the execution of one or
more @i<tasks>. Each task represents a separable activity that proceeds
independently and concurrently between the points where it @i<interacts> with
other tasks. A single task, when within the context of a parallel construct,
can represent multiple @i<logical threads of control> which can proceed in
parallel; in other contexts, each task represents one logical thread of
control.
!corrigendum 9.5(17/3)
!AI-0064-2
!AI-0247-1
!AI-0267-1
!AI-0319-1
!AI-0374-1
@dinsa
In addition to the places where Legality Rules normally apply (see 12.3),
these rules also apply in the private part of an instance of a generic unit.
@dinss
@s8<@i<Static Semantics>>
An @fa<expression> is @i<nonblocking-static> if it is one of the following:
@xbullet<a static expression;>
@xbullet<a Nonblocking @fa<attribute_reference>;>
@xbullet<a call to a predefined boolean logical operator @b<and> where each
operand is nonblocking-static;>
@xbullet<an @b<and then> short-circuit control form where each operand is
nonblocking-static;>
@xbullet<a parenthesized nonblocking-static @fa<expression>.>
For a program unit, task entry, formal package, formal
subprogram, formal object of an anonymous access-to-subprogram type,
enumeration literal, and for a subtype (including a formal subtype), the
following language-defined operational aspect is defined:
@xhang<@xterm<Nonblocking>
This aspect specifies the blocking restriction for the entity; it shall
be specified by an @fa<expression>, called a @i<nonblocking expression>. If
directly specified, the @fa<aspect_definition> shall be a
nonblocking-static expression. The expected type for the @fa<expression> is
the predefined type Boolean. The @fa<aspect_definition> can be
omitted from the specification of this aspect; in that case the
nonblocking expression for the entity is the enumeration literal True.>
@xindent<The Nonblocking aspect may be specified for all entities for
which it is defined, except for protected operations and
task entries. In particular, Nonblocking may be specified for
generic formal parameters.>
@xindent<When the nonblocking expression is static for an entity,
the expression is evaluated to produce a static value for the aspect.
When aspect Nonblocking is statically False for an entity, the entity
might contain a potentially blocking operation; such an entity @i<allows
blocking>. If the aspect is statically True for an entity, the entity
is said to be @i<nonblocking>.>
@xindent<For a generic unit @i<G>, if the aspect Nonblocking is statically true
for @i<G> (by inheritance or specification), then the nonblocking expression for
@i<G> is the @b<and> of the nonblocking attribute for each formal parameter of
@i<G>.>
@xindent<For a generic instantiation and entities declared within such an
instance, the aspect is determined by the nonblocking
expression for the corresponding entity of the generic unit, with
any Nonblocking attributes of the generic formal parameters replaced
by the appropriate nonblocking expression of the corresponding actual
parameters. If the aspect is directly specified for an instance, the
specified expression shall be static and have the same value as the
nonblocking expression of the instance (after replacement).>
@xindent<For a (protected or task) entry, the Nonblocking aspect is
the Boolean literal False.>
@xindent<For an enumeration literal, the Nonblocking aspect is the Boolean
literal True.>
@xindent<For a predefined operator of an elementary type, the Nonblocking
aspect is the Boolean literal True. For a predefined operator of a
composite type, the Nonblocking aspect of the operator is
the same as the Nonblocking aspect for the type.>
@xindent<For a dereference of an access-to-subprogram type, the Nonblocking
aspect of the designated subprogram is that of the access-to-subprogram type.>
@xindent<For the base subtype of a scalar (sub)type, the Nonblocking aspect is
the Boolean literal True.>
@xindent<For an inherited primitive dispatching subprogram that is null or
abstract, the subprogram is nonblocking if and only if a corresponding
subprogram of at least one ancestor is nonblocking. For any other
inherited subprogram, it is nonblocking if and only if the
corresponding subprogram of the parent is nonblocking.>
@xindent<Unless directly specified, overridings of dispatching operations
inherit this aspect.>
@xindent<Unless directly specified, for a formal subtype, formal package, or
formal subprogram, the Nonblocking aspect is that of the actual subtype,
package, or subprogram.>
@xindent<Unless directly specified, for a derived type, the Nonblocking
aspect is that of the parent type.>
@xindent<Unless directly specified, for any other program unit, type, or
formal object, the Nonblocking aspect of the entity is determined by the
Nonblocking aspect for the innermost program unit enclosing the entity.>
@xindent<If not specified for a library unit, the nonblocking expression
is the Boolean literal True if the library unit is declared pure and is
not a generic unit, or the Boolean literal False otherwise.>
For a @fa<prefix> S that denotes a subprogram (including a formal subprogram),
the following attribute is defined:
@xhang<@xterm<S'Nonblocking>
Denotes whether subprogram S is considered nonblocking; the type
of this attribute is the predefined type Boolean.>
@xindent<The @fa<prefix> S shall statically denote a subprogram.>
@xindent<S'Nonblocking represents the nonblocking expression of S;
evaluation of S'Nonblocking evaluates that expression.>
For a @fa<prefix> P that denotes a package (including a formal package),
the following attribute is defined:
@xhang<@xterm<P'Nonblocking>
Denotes whether package P is considered nonblocking; the type
of this attribute is the predefined type Boolean.
P'Nonblocking represents the nonblocking expression of P;
evaluation of P'Nonblocking evaluates that expression.>
For a @fa<prefix> S that denotes a subtype (including formal subtypes),
the following attribute is defined:
@xhang<@xterm<S'Nonblocking>
Denotes whether default initialization, finalization, assignment,
predefined operators, and (in the case of
access-to-subprogram subtypes) a subprogram designated by a value of
subtype S are considered nonblocking; the type of this attribute is the
predefined type Boolean. S'Nonblocking represents the nonblocking
expression of S; evaluation of S'Nonblocking evaluates that expression.>
For a @fa<prefix> X that denotes an object, the following attribute is defined:
@xhang<@xterm<X'Nonblocking>
Denotes whether the subtype of X is considered nonblocking; the type of this
attribute is the predefined type Boolean. X'Nonblocking represents the
nonblocking expression of X; evaluation of X'Nonblocking evaluates that
expression.>
For a @fa<prefix> X that denotes an object of a class-wide type T'Class, the
following attribute is defined:
@xhang<@xterm<X'Nonblocking(dispatching_operation_set)>
X'Nonblocking(@fa<dispatching_operation_set>) represents the @b<and> of
the Nonblocking aspect of the tagged type @i<T1> identified by the tag
of X, and the Nonblocking aspects of the dispatching operations of @i<T1>
corresponding to the
specified dispatching operations of T (or all dispatching operations
of T if the set is the reserved word @b<all>). If a
@i<dispatching_>@fa<selector_name> within the set denotes multiple
dispatching operations of T, the Nonblocking aspects of all of the
corresponding dispatching operations of @i<T1> are @b<and>ed together.>
The following are defined to be @i<potentially blocking> operations:
@xbullet<a @fa<select_statement>;>
@xbullet<an @fa<accept_statement>;>
@xbullet<an @fa<entry_call_statement>, or a call on a procedure that
renames or is implemented by an entry;>
@xbullet<a @fa<delay_statement>;>
@xbullet<an @fa<abort_statement>;>
@xbullet<task creation or activation;>
@xbullet<during a protected action, an external call on a protected subprogram
(or an external requeue) with the same target object as that of the
protected action.>
If a language-defined subprogram allows blocking, then a call on the
subprogram is a potentially blocking operation.
@s8<@i<Legality Rules>>
A parallel construct or a nonblocking program unit shall not contain, other
than within nested units with Nonblocking specified as statically False, a
call on a callable entity for which the Nonblocking aspect is statically
False, nor shall it contain any of the following:
@xbullet<a @fa<select_statement>;>
@xbullet<an @fa<accept_statement>;>
@xbullet<a @fa<delay_statement>;>
@xbullet<an @fa<abort_statement>;>
@xbullet<task creation or activation.>
For the purposes of the above rule, an @fa<entry_body> is considered
nonblocking if the immediately enclosing protected unit is nonblocking.
For a subtype for which aspect Nonblocking is True, any predicate
expression that applies to the subtype shall only contain
constructs that are allowed immediately within a nonblocking program
unit.
A subprogram shall be nonblocking if it overrides a nonblocking
dispatching operation. An entry shall not implement a nonblocking
procedure. If an inherited dispatching subprogram allows blocking, then
the corresponding subprogram of each ancestor shall allow blocking.
It is illegal to specify aspect Nonblocking for the full view of a type
that has a partial view.
Aspect Nonblocking shall be specified for the first subtype of a derived type
only if it fully conforms to the nonblocking expression of the ancestor
subtype or if it is specified to have the Boolean literal True. Aspect
Nonblocking shall be specified for a nonfirst subtype @i<S> only if it fully
conforms to the nonblocking expression of the subtype identified in the
@fa<subtype_indication> defining @i<S> or if it is specified to have the
Boolean literal True. Aspect Nonblocking shall be specified for a first
subtype @i<S> that completes an incomplete or partial view @i<P> only if it
fully conforms to the nonblocking expression of the subtype @i<P> or if it is
specified to have the Boolean literal True.
If aspect Nonblocking is specified for an entity that is not a generic
unit or declared inside of a generic unit, the @fa<aspect_definition> shall
be a static expression.
If the prefix of a Nonblocking @fa<attribute_reference> denotes a generic
unit @i<G>, the reference shall occur within the declarative region of @i<G>.
For a composite type that is nonblocking:
@xbullet<All component subtypes shall be nonblocking;>
@xbullet<For a record type or extension, every call in the
@fa<default_expression> of a component (including discriminants) shall call
an operation that is nonblocking;>
@xbullet<For a controlled type, the Initialize, Finalize, and Adjust (if any)
subprograms shall be nonblocking.>
The predefined equality operator for a composite type is illegal if it is
nonblocking and, for a record type, it is not overridden by a primitive
equality operator, and:
@xbullet<for a record type, the parent primitive "=" allows blocking; or>
@xbullet<any component that has a record type that has a primitive "=" that
allows blocking; or>
@xbullet<any component that has a non-record type that has a predefined "="
that allows blocking.>
In a generic instantiation (after replacement in the nonblocking
expressions by values of the actuals as described previously):
@xbullet<the actual subprogram corresponding to a nonblocking formal
subprogram shall be nonblocking (an actual that is an
entry is not permitted in this case);>
@xbullet<the actual type corresponding to a nonblocking formal
private, derived, array, or access-to-subprogram type shall
be nonblocking;>
@xbullet<the actual object corresponding to a formal object of a
nonblocking access-to-subprogram type shall be of a nonblocking
access-to-subprogram type;>
@xbullet<the actual instance corresponding to a nonblocking formal package
shall be nonblocking.>
In addition to the places where Legality Rules normally apply
(see 12.3), the above rules also apply in the private part of an
instance of a generic unit.
A program unit @i<P> declared inside of a generic unit but not in a generic body
or that is a generic specification not declared in a generic unit
is considered nonblocking for the purposes of checking the restrictions on a
nonblocking unit only if the value of its Nonblocking aspect is statically
True. For the purposes of checks in @i<P>, a call to a subprogram is considered
nonblocking unless the value of its Nonblocking aspect is statically False.
A program unit @i<P> declared inside of a generic body or that is a generic body
is considered nonblocking for the purposes of checking the restrictions on a
nonblocking unit unless the value of its Nonblocking aspect is statically
False. For the purposes of checks in @i<P>, a call to a subprogram is considered
to allow blocking unless:
@xbullet<the value of its Nonblocking aspect is statically True, or>
@xbullet<its nonblocking expression (that is, Nonblocking aspect)
conforms exactly to that of @i<P>, or conforms to some part of the
nonblocking expression of @i<P> that is combined with the remainder of the
nonblocking expression of @i<P> by one or more @b<and> or @b<and then>
operations.>
!corrigendum 9.5.1(18)
!AI-0064-2
!AI-0247-1
@drepl
Certain language-defined subprograms are potentially blocking. In particular,
the subprograms of the language-defined input-output packages that manipulate
files (implicitly or explicitly) are potentially blocking. Other potentially
blocking subprograms are identified where they are defined. When not
specified as potentially blocking, a language-defined subprogram is
nonblocking.
@dby
During a protected action, a call on a subprogram whose body contains a
potentially blocking operation is a bounded error. If the bounded error is
detected, Program_Error is raised; otherwise, the call proceeds normally.
!corrigendum 9.6(10)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<
@b<package> Ada.Calendar @b<is>
@b<type> Time @b<is private>;>
@dby
@xcode<
@b<package> Ada.Calendar
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<type> Time @b<is private>;>
!corrigendum 9.6.1(2/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Calendar.Time_Zones @b<is>>
@dby
@xcode<@b<package> Ada.Calendar.Time_Zones
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum 9.6.1(8/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<
@b<package> Ada.Calendar.Arithmetic @b<is>>
@dby
@xcode<
@b<package> Ada.Calendar.Arithmetic
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum 9.6.1(15/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<
@b<with> Ada.Calendar.Time_Zones;
@b<package> Ada.Calendar.Formatting @b<is>>
@dby
@xcode<
@b<with> Ada.Calendar.Time_Zones;
@b<package> Ada.Calendar.Formatting
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum 9.6.1(35/2)
!AI-0336-1
!AI-0347-1
@dinsa
@xcode< @b<function> Image (Date : Time;
Include_Time_Fraction : Boolean := False;
Time_Zone : Time_Zones.Time_Offset := 0) @b<return> String;>
@dinst
@xcode< @b<function> Local_Image (Date : Time;
Include_Time_Fraction : Boolean := False) @b<return> String @b<is>
(Image (Date, Include_Time_Fraction, Time_Zones.Local_Time_Offset (Date)));>
!corrigendum 9.10(1/3)
!AI-0119-1
!AI-0363-1
@drepl
If two different objects, including nonoverlapping parts of the same object,
are @i<independently addressable>, they can be manipulated concurrently by two
different tasks without synchronization. Any two nonoverlapping objects are
independently addressable if either object is specified as independently
addressable (see C.6). Otherwise, two nonoverlapping objects are independently
addressable except when they are both parts of a composite object for which a
nonconfirming value is specified for any of the following representation
aspects: (record) Layout, Component_Size, Pack, Atomic, or Convention; in this
case it is unspecified whether the parts are independently addressable.
@dby
If two different objects, including nonoverlapping parts of the same object,
are @i<independently addressable>, they can be manipulated concurrently by two
different logical threads of control without synchronization, unless both are
subcomponents of the same full access object, and either is nonatomic (see C.6).
Any two nonoverlapping objects are
independently addressable if either object is specified as independently
addressable (see C.6). Otherwise, two nonoverlapping objects are independently
addressable except when they are both parts of a composite object for which a
nonconfirming value is specified for any of the following representation
aspects: (record) Layout, Component_Size, Pack, Atomic, or Convention; in this
case it is unspecified whether the parts are independently addressable.
!corrigendum 9.10(15)
!AI-0267-1
!AI-0298-1
@drepl
Aspect Atomic or aspect Atomic_Components may also be specified to ensure
that certain reads and updates are sequential @emdash see C.6.
@dby
Two actions that are not sequential are defined to be @i<concurrent>
actions.
Two actions are defined to @i<conflict> if one action assigns to an
object, and the other action reads or assigns to a part of the same
object (or of a neighboring object if the two are not independently
addressable). The action comprising a call on a subprogram or an
entry is defined to @i<potentially conflict> with another action if the
Global aspect (or Global'Class aspect in the case of a dispatching
call) of the called subprogram or entry is such that a conflicting
action would be possible during the execution of the call. Similarly,
two calls are considered to potentially conflict if they each have
Global (or Global'Class in the case of a dispatching call) aspects
such that conflicting actions would be possible during the execution
of the calls. Finally, two actions that conflict are also considered
to potentially conflict.
A @i<synchronized> object is an object of a task or protected type, an
atomic object (see C.6), a suspension object (see D.10), or a
synchronous barrier (see D.10.1). Operations on such
objects are necessarily sequential with respect to one another, and
hence are never considered to conflict.
@s8<@i<Erroneous Execution>>
The execution of two concurrent actions is erroneous if the actions make
conflicting uses of a shared variable (or neighboring variables that are
not independently addressable).
!corrigendum 9.10.1(0)
!AI-0267-1
!AI-0294-1
!AI-0298-1
!AI-0344-1
@dinsc
This subclause determines what checks are performed relating to possible
concurrent conflicting actions (see 9.10).
@s8<@i<Syntax>>
The form of a @fa<pragma> Conflict_Check_Policy is as follows:
@xcode<@ft<@b<pragma> Conflict_Check_Policy(@i<policy_>>@fa<identifier>@ft<[, @i<policy_>>@fa<identifier>@ft<]);>>
A @fa<pragma> Conflict_Check_Policy is allowed only immediately within a
@fa<declarative_part>, a @fa<package_specification>, or as a configuration pragma.
@s8<@i<Legality Rules>>
Each @i<policy_>@fa<identifier> shall be one of No_Parallel_Conflict_Checks,
Known_Parallel_Conflict_Checks, All_Parallel_Conflict_Checks,
No_Tasking_Conflict_Checks, Known_Tasking_Conflict_Checks,
All_Tasking_Conflict_Checks, No_Conflict_Checks,
Known_Conflict_Checks, All_Conflict_Checks, or an
implementation-defined conflict check policy. If two
@i<policy_>@fa<identifier>s are given, one shall include the word Parallel
and one shall include the word Tasking. If only one
@i<policy_>@fa<identifier> is given, it shall not include the word Parallel
or Tasking.
A @fa<pragma> Conflict_Check_Policy given in a @fa<declarative_part> or
immediately within a @fa<package_specification> applies from the place of
the pragma to the end of the innermost enclosing declarative region.
The region for a @fa<pragma> Conflict_Check_Policy given as a configuration
pragma is the declarative region for the entire compilation unit (or
units) to which it applies.
If a @fa<pragma> Conflict_Check_Policy applies to a @fa<generic_instantiation>,
then the @fa<pragma> Conflict_Check_Policy applies to the entire instance.
If multiple Conflict_Check_Policy pragmas apply to a given construct,
the conflict check policy is determined by the one in the innermost
enclosing region. If no Conflict_Check_Policy pragma applies to a
construct, the policy is (All_Parallel_Conflict_Checks,
No_Tasking_Conflict_Checks) (see below).
Certain potentially conflicting actions are disallowed according to which
conflict check policies apply at the place where the action or actions
occur, as follows:
@xhang<@xterm<No_Parallel_Conflict_Checks>
This policy imposes no restrictions on concurrent actions arising from
parallel constructs.>
@xhang<@xterm<No_Tasking_Conflict_Checks>
This policy imposes no restrictions on concurrent actions arising from
tasking constructs.>
@xhang<@xterm<Known_Parallel_Conflict_Checks>
If this policy applies to two concurrent actions appearing within
parallel constructs, they are disallowed if they are known to denote
the same object (see 6.4.1) with uses that conflict. For
the purposes of this check, any parallel loop may be presumed to
involve multiple concurrent iterations. Also, for the purposes of
deciding whether two actions are concurrent, it is enough for the
logical threads of control in which they occur to be concurrent at
any point in their execution, unless all of the following are true:>
@xinbull<the shared object is volatile;>
@xinbull<the two logical threads of control are both known to also refer to
a shared synchronized object; and>
@xinbull<each thread whose potentially conflicting action updates the
shared volatile object, also updates this shared synchronized object.>
@xhang<@xterm<Known_Tasking_Conflict_Checks>
If this policy applies to two concurrent actions appearing within
the same compilation unit, at least one of which appears within a
task body but not within a parallel construct, they are disallowed
if they are known to denote the same object (see 6.4.1) with uses
that conflict, and neither potentially signals the other (see 9.10).
For the purposes of this check, any named
task type may be presumed to have multiple instances. Also, for the
purposes of deciding whether two actions are concurrent, it is
enough for the tasks in which they occur to be concurrent at any
point in their execution, unless all of the following are true:>
@xinbull<the shared object is volatile;>
@xinbull<the two tasks are both known to also refer to a shared
synchronized object; and>
@xinbull<each task whose potentially conflicting action updates the
shared volatile object, also updates this shared synchronized object.>
@xhang<@xterm<All_Parallel_Conflict_Checks>
This policy includes the restrictions imposed by the
Known_Parallel_Conflict_Checks policy, and in addition disallows a
parallel construct from reading or updating a variable that is
global to the construct, unless it is a synchronized object, or
unless the construct is a parallel loop, and the global variable is
a part of a component of an array denoted by an indexed component
with at least one index expression that statically denotes the loop
parameter of the @fa<loop_parameter_specification> or the chunk parameter
of the parallel loop.>
@xhang<@xterm<All_Tasking_Conflict_Checks>
This policy includes the restrictions imposed by the
Known_Tasking_Conflict_Checks policy, and in addition disallows a
task body from reading or updating a variable that is global to the
task body, unless it is a synchronized object.>
@xhang<@xterm<No_Conflict_Checks, Known_Conflict_Checks, All_Conflict_Checks>
These are short hands for (No_Parallel_Conflict_Checks,
No_Tasking_Conflict_Checks), (Known_Parallel_Conflict_Checks,
Known_Tasking_Conflict_Checks), and (All_Parallel_Conflict_Checks,
All_Tasking_Conflict_Checks), respectively.>
@s8<@i<Static Semantics>>
For a subprogram, the following language-defined representation aspect may be
specified:
@xhang<@xterm<Parallel_Calls>
The Parallel_Calls aspect is of type Boolean. The specified value
shall be static. The Parallel_Calls aspect of an inherited primitive
subprogram is True if Parallel_Calls is True either for the
corresponding subprogram of the progenitor type or for any other
inherited subprogram that it overrides. If not specified or
inherited as True, the Parallel_Calls aspect of a subprogram is False.>
@xindent<Specifying the Parallel_Calls aspect to be True for a subprogram
indicates that the subprogram can be safely called in parallel.
Conflict checks (if required by the Conflict_Check_Policy in effect)
are made on the subprogram assuming that multiple concurrent calls
exist. Such checks need not be repeated at each call of the
subprogram in a parallel iteration context.>
@s8<@i<Implementation Permissions>>
When the conflict check policy Known_Parallel_Conflict_Checks applies,
the implementation may disallow two concurrent actions appearing
within parallel constructs if the implementation can prove they will
at run-time denote the same object with uses that conflict. Similarly,
when the conflict check policy Known_Tasking_Conflict_Checks applies,
the implementation may disallow two concurrent actions, at least one
of which appears within a task body but not within a parallel
construct, if the implementation can prove they will at run-time
denote the same object with uses that conflict.
!corrigendum 11.4.1(2/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Streams;
@b<package> Ada.Exceptions @b<is>
@b<pragma> Preelaborate(Exceptions);
@b<type> Exception_Id @b<is private>;
@b<pragma> Preelaborable_Initialization(Exception_Id);
Null_Id : @b<constant> Exception_Id;
@b<function> Exception_Name(Id : Exception_Id) @b<return> String;
@b<function> Wide_Exception_Name(Id : Exception_Id) @b<return> Wide_String;
@b<function> Wide_Wide_Exception_Name(Id : Exception_Id)
@b<return> Wide_Wide_String;>
@dby
@xcode<@b<with> Ada.Streams;
@b<package> Ada.Exceptions
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<type> Exception_Id @b<is private>;
@b<pragma> Preelaborable_Initialization(Exception_Id);
Null_Id : @b<constant> Exception_Id;
@b<function> Exception_Name(Id : Exception_Id) @b<return> String;
@b<function> Wide_Exception_Name(Id : Exception_Id) @b<return> Wide_String;
@b<function> Wide_Wide_Exception_Name(Id : Exception_Id)
@b<return> Wide_Wide_String;>
!corrigendum 11.4.2(23.1/3)
!AI-0112-1
!AI-0179-1
!AI-0265-1
!AI-0311-1
@dinsa
It is a bounded error to invoke a potentially blocking operation (see 9.5.1)
during the evaluation of an assertion expression associated with a call on, or
return from, a protected operation. If the bounded error is detected,
Program_Error is raised. If not detected, execution proceeds normally, but if
it is invoked within a protected action, it might result in deadlock or a
(nested) protected action.
@dinss
@s8<@i<Implementation Requirements>>
Any postcondition expression, type invariant expression, or default initial
condition expression occurring in the specification of a language-defined unit
is enabled (see 6.1.1, 7.3.2, and 7.3.3).
The evaluation of any such postcondition, type invariant, or default initial
condition expression shall either yield True or propagate an exception from
a @fa<raise_expression> that appears within the assertion expression.
Any precondition expression occurring in the specification of a
language-defined unit is enabled (see 6.1.1) unless suppressed (see 11.5).
Similarly, any predicate checks for a subtype occurring in the specification
of a language-defined unit are enabled (see 3.2.4) unless suppressed.
!corrigendum 11.5(23)
!AI-0112-1
!AI-0309-1
!AI-0311-1
@dinsa
@xhang<@xterm<Storage_Check>
Check that evaluation of an @fa<allocator> does not require more space than
is available for a storage pool. Check that the space available for a task
or subprogram has not been exceeded.>
@dinss
@xbullet<The following check corresponds to situations in which the exception
Tasking_Error is raised upon failure of a language-defined check.>
@xhang<@xterm<Tasking_Check>
Check that all tasks activated successfully. Check that a called task
has not yet terminated.>
@xbullet<The following checks correspond to situations in which the
exception Assertion_Error is raised upon failure of a language-defined
check. For a language-defined unit @i<U> associated with one of these
checks in the list below, the check refers to performance of checks
associated with the Pre, Static_Predicate, and Dynamic_Predicate
aspects associated with any entity declared in a descendant of @i<U>, or
in an instance of a generic unit which is, or is declared in, a
descendant of @i<U>. Each check is associated with one or more units:>
@xhang<@xterm<Calendar_Assertion_Check>Calendar.>
@xhang<@xterm<Characters_Assertion_Check>Characters, Wide_Characters,
and Wide_Wide_Characters.>
@xhang<@xterm<Containers_Assertion_Check>Containers.>
@xhang<@xterm<Interfaces_Assertion_Check>Interfaces.>
@xhang<@xterm<IO_Assertion_Check>Sequential_IO, Direct_IO, Text_IO,
Wide_Text_IO, Wide_Wide_Text_IO, Storage_IO,
Streams.Stream_IO, and Directories.>
@xhang<@xterm<Numerics_Assertion_Check>Numerics.>
@xhang<@xterm<Strings_Assertion_Check>Strings.>
@xhang<@xterm<System_Assertion_Check>System.>
!corrigendum 11.5(26)
!AI-0112-1
!AI-0311-1
@drepl
If a given check has been suppressed, and the corresponding error situation
occurs, the execution of the program is erroneous.
@dby
If a given check has been suppressed, and the corresponding error situation
occurs, the execution of the program is erroneous. Similarly, if a
precondition check has been suppressed and the evaluation of the precondition
would have raised an exception, execution is erroneous.
!corrigendum 12.6(8.2/2)
!AI-0183-1
!AI-0287-1
@drepl
@xbullet<if the actual matching the @fa<formal_subprogram_declaration>
denotes a generic formal object of another generic unit @i<G>, and the
instantiation containing the actual that occurs within the body
of a generic unit @i<G> or within the body of a generic unit declared within
the declarative region of the generic unit @i<G>, then the corresponding
parameter or result type of the formal subprogram of @i<G> shall have a
@fa<null_exclusion>;>
@dby
@xbullet<if the actual matching the @fa<formal_subprogram_declaration>
statically denotes a generic formal subprogram of another generic unit @i<G>,
and the instantiation containing the actual occurs within the body
of a generic unit @i<G> or within the body of a generic unit declared within
the declarative region of the generic unit @i<G>, then the corresponding
parameter or result type of the formal subprogram of @i<G> shall have a
@fa<null_exclusion>;>
!corrigendum 13.1(9/4)
!AI-0181-1
!AI-0222-1
@drepl
A representation item that directly specifies an aspect of an entity shall
appear before the entity is frozen (see 13.14). In addition, a
representation item that directly specifies an aspect of a subtype or type
shall appear after the type is completely defined (see 3.11.1).
@dby
A representation item or operational item that directly specifies an aspect
of an entity shall appear before the entity is frozen (see 13.14).
!corrigendum 13.1(9.1/4)
!AI-0181-1
!AI-0222-1
@drepl
An operational item that directly specifies an aspect of an entity shall
appear before the entity is frozen (see 13.14).
@dby
An @fa<expression> or @fa<name> that freezes an entity shall not occur within
an @fa<aspect_specification> that specifies a representation or operational
aspect of that entity.
A representation aspect of a subtype or type shall not be specified (whether
by a representation item or an @fa<aspect_specification>) before the type is
completely defined (see 3.11.1).
!corrigendum 13.1.1(4/3)
!AI-0187-1
!AI-0285-1
!AI-0373-1
@drepl
@xindent<@fa<aspect_definition>@fa<@ ::=@ >@fa<name> | @fa<expression> | @fa<identifier>>
@dby
@xindent<@fa<aspect_definition>@fa<@ ::=@ >@hr
@ @ @ @ @fa<name>@ |@ @fa<expression>@ |@ @fa<identifier>@hr
@ @ |@ @fa<aggregate>@ |@ @fa<global_aspect_definition>>
!corrigendum 13.1.1(12/3)
!AI-0180-1
!AI-0220-1
@drepl
If the associated declaration is for a subprogram or entry, the names of the
formal parameters are directly visible within the @fa<aspect_definition>, as are certain
attributes, as specified elsewhere in this International Standard for the
identified aspect. If the associated declaration is a @fa<type_declaration>, within
the @fa<aspect_definition> the names of any components are directly visible, and the
name of the first subtype denotes the current instance of the type (see 8.6). If the
associated declaration is a @fa<subtype_declaration>, within the
@fa<aspect_definition> the name of the new subtype denotes the current instance
of the subtype.
@dby
If the associated declaration is for a subprogram, entry, or access-to-subprogram
type, the names of the
formal parameters are directly visible within the @fa<aspect_definition>, as
are certain attributes, as specified elsewhere in this International Standard
for the identified aspect. If the associated declaration is a @fa<type_declaration>,
within the @fa<aspect_definition> the names of any visible components, protected
subprograms, and entries are directly visible, and the name of the first subtype
denotes the current instance of the type (see 8.6). If the associated declaration
is a @fa<subtype_declaration>, within the @fa<aspect_definition> the name of the
new subtype denotes the current instance of the subtype.
!corrigendum 13.1.1(17/3)
!AI-0064-2
!AI-0194-1
@drepl
There are no language-defined aspects that may be specified on a @fa<renaming_declaration>,
a @fa<generic_formal_parameter_declaration>, a @fa<subunit>, a @fa<package_body>,
a @fa<task_body>, a @fa<protected_body>, or a @fa<body_stub> other than a
@fa<subprogram_body_stub>.
@dby
There are no language-defined aspects that may be specified on
a @fa<renaming_declaration>, a @fa<subunit>, a @fa<package_body>,
a @fa<task_body>, a @fa<protected_body>, an @fa<entry_body>, or a @fa<body_stub>
other than a @fa<subprogram_body_stub>.
!corrigendum 13.1.1(18.3/4)
!AI-0206-1
!AI-0211-1
@drepl
If a nonoverridable aspect is directly specified for a type @i<T>, then any
explicit specification of that aspect for any other descendant of @i<T>
shall be @i<confirming>; that is, the specified @fa<name> shall @i<match>
the inherited aspect, meaning that the specified @fa<name> shall denote the
same declarations as would the inherited @fa<name>.
@dby
If a nonoverridable aspect is directly specified for a type @i<T>, then any
explicit specification of that aspect for any descendant of @i<T>
(other than @i<T> itself) shall be @i<confirming>. In the case of an aspect
whose value is a @fa<name>,
this means that the specified @fa<name> shall @i<match> the inherited aspect
in the sense that it shall denote the same declarations as would the inherited
@fa<name>.
!corrigendum 13.1.1(18.6/4)
!comment This was the original paragraph number, AI12-0211-1 changed it.
!comment We have to use the original number here so that a conflict is
!comment properly detected.
!AI-0206-1
!AI-0256-1
!AI-0373-1
@drepl
The Default_Iterator, Iterator_Element, Implicit_Dereference,
Constant_Indexing, and Variable_Indexing aspects are nonoverridable.
@dby
The Default_Iterator, Iterator_Element, Implicit_Dereference,
Constant_Indexing, Variable_Indexing, Aggregate, Max_Entry_Queue_Length, and
No_Controlled_Parts aspects are nonoverridable.
!corrigendum 13.7.2(2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<generic>
@b<type> Object(<@>) @b<is limited private>;
@b<package> System.Address_To_Access_Conversions @b<is>
@b<pragma> Preelaborate(Address_To_Access_Conversions);>
@dby
@xcode<@b<generic>
@b<type> Object(<@>) @b<is limited private>;
@b<package> System.Address_To_Access_Conversions
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum 13.11.2(3/3)
!AI-0241-1
!AI-0302-1
!AI-0319-1
@drepl
@xcode<@b<generic>
@b<type> Object(<@>) @b<is limited private>;
@b<type> Name @b<is access> Object;
@b<procedure> Ada.Unchecked_Deallocation(X : @b<in out> Name)
@b<with> Convention =@> Intrinsic;
@b<pragma> Preelaborate(Ada.Unchecked_Deallocation);>
@dby
@xcode<@b<generic>
@b<type> Object(<@>) @b<is limited private>;
@b<type> Name @b<is access> Object;
@b<procedure> Ada.Unchecked_Deallocation(X : @b<in out> Name)
@b<with> Preelaborate, Global =@> @b<in out synchronized>,
Nonblocking =@> Object'Nonblocking @b<and> Name'Storage_Pool'Nonblocking,
Convention =@> Intrinsic;>
!corrigendum 13.13.1(9)
!AI-0293-1
!AI-0302-1
!AI-0329-1
@dinsa
The Write operation appends Item to the specified stream.
@dinss
Three additional packages provide stream implementations that do not make
use of any file operations. These packages provide the same operations,
with Streams.Storage providing an abstract interface, and two child
packages providing implementations of that interface. The difference is that
for Streams.Storage.Bounded, the maximum storage is bounded.
The library package Ada.Streams.Storage has the following declaration:
@xcode<@b<package> Ada.Streams.Storage
@b<with> Pure, Nonblocking @b<is>>
@xcode< @b<type> Storage_Stream_Type @b<is abstract new> Root_Stream_Type @b<with private>;>
@xcode< @b<function> Element_Count (Stream : Storage_Stream_Type)
@b<return> Stream_Element_Count @b<is abstract>;>
@xcode< @b<procedure> Clear (Stream : @b<in out> Storage_Stream_Type) @b<is abstract>;>
@xcode<@b<private>
... -- @ft<@i<not specified by the language>>
@b<end> Ada.Streams.Storage;>
The library package Ada.Streams.Storage.Unbounded has the following
declaration:
@xcode<@b<package> Ada.Streams.Storage.Unbounded
@b<with> Prelaborated, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
@xcode< @b<type> Stream_Type @b<is new> Storage_Stream_Type @b<with private>
@b<with> Default_Initial_Condition =@>
Element_Count (Stream_Type) = 0;>
@xcode< @b<overriding>
@b<procedure> Read (
Stream : @b<in out> Stream_Type;
Item : @b<out> Stream_Element_Array;
Last : @b<out> Stream_Element_Offset)
@b<with> Post =@>
(@b<declare>
Num_Read : @b<constant> Stream_Element_Count :=
Stream_Element_Count'Min
(Element_Count(Stream)'Old, Item'Length);
@b<begin>
Last = Num_Read + Item'First - 1
@b<and>
Element_Count (Stream) =
Element_Count (Stream)'Old - Num_Read);>
@xcode< @b<overriding>
@b<procedure> Write (
Stream : @b<in out> Stream_Type;
Item : @b<in> Stream_Element_Array)
@b<with> Post =@>
Element_Count (Stream) =
Element_Count (Stream)'Old + Item'Length;>
@xcode< @b<overriding>
@b<function> Element_Count (Stream : Stream_Type)
@b<return> Stream_Element_Count;>
@xcode< @b<overriding>
@b<procedure> Clear (Stream : @b<in out> Stream_Type)
@b<with> Post =@> Element_Count (Stream) = 0;>
@xcode<@b<private>
... -- @ft<@i<not specified by the language>>
@b<end> Ada.Streams.Storage.Unbounded;>
The library package Ada.Streams.Storage.Bounded has the following
declaration:
@xcode<@b<package> Ada.Streams.Storage.Bounded
@b<with> Pure, Nonblocking @b<is>>
@xcode< @b<type> Stream_Type (Max_Elements : Stream_Element_Count)
@b<is new> Storage_Stream_Type @b<with private>
@b<with> Default_Initial_Condition =@>
Element_Count (Stream_Type) = 0;>
@xcode< @b<overriding>
@b<procedure> Read (
Stream : @b<in out> Stream_Type;
Item : @b<out> Stream_Element_Array;
Last : @b<out> Stream_Element_Offset)
@b<with> Post =@>
(@b<declare>
Num_Read : @b<constant> Stream_Element_Count :=
Stream_Element_Count'Min
(Element_Count(Stream)'Old, Item'Length);
@b<begin>
Last = Num_Read + Item'First - 1
@b<and>
Element_Count (Stream) =
Element_Count (Stream)'Old - Num_Read);>
@xcode< @b<overriding>
@b<procedure> Write (
Stream : @b<in out> Stream_Type;
Item : @b<in> Stream_Element_Array)
@b<with> Pre =@>
Element_Count (Stream) + Item'Length <= Stream.Max_Elements
@b<or else> (@b<raise> Constraint_Error),
Post =@>
Element_Count (Stream) =
Element_Count (Stream)'Old + Item'Length;>
@xcode< @b<overriding>
@b<function> Element_Count (Stream : Stream_Type)
@b<return> Stream_Element_Count
@b<with> Post =@> Element_Count'Result <= Stream.Max_Elements;>
@xcode< @b<overriding>
@b<procedure> Clear (Stream : @b<in out> Stream_Type)
@b<with> Post =@> Element_Count (Stream) = 0;>
@xcode<@b<private>
... -- @ft<@i<not specified by the language>>
@b<end> Ada.Streams.Storage.Bounded;>
The Element_Count functions return the number of stream elements
that are available for reading from the given stream.
The Read and Write procedures behave as described for package
Ada.Streams above.
Stream elements are read in FIFO (first-in, first-out) order; stream
elements are available for reading immediately after they are written.
The Clear procedures remove any available stream elements from the given
stream.
!corrigendum 13.13.1(9.1/1)
!AI-0293-1
!AI-0329-1
@dinsa
If Stream_Element'Size is not a multiple of System.Storage_Unit, then the
components of Stream_Element_Array need not be aliased.
@dinst
@s8<@i<Implementation Advice>>
Streams.Storage.Bounded.Stream_Type objects should be implemented without
implicit pointers or dynamic allocation.
!corrigendum 13.14(3/4)
!AI-0155-1
!AI-0168-1
!AI-0373-1
@drepl
The end of a @fa<declarative_part>, @fa<protected_body>, or a declaration of a
library package or generic library package, causes @i<freezing> of each entity
and profile declared within it, except for incomplete types. A @fa<proper_body>,
@fa<body_stub>, or @fa<entry_body> causes freezing of each entity and profile
declared before it within the same @fa<declarative_part> that is not an
incomplete type; it only causes freezing of an incomplete type if the body is
within the immediate scope of the incomplete type.
@dby
The end of a @fa<declarative_part>, @fa<protected_body>, or a declaration of a
library package or generic library package, causes @i<freezing> of each entity
and profile declared within it, as well as the entity itself
in the case of the declaration of a library unit. A noninstance @fa<proper_body>,
@fa<body_stub>, or @fa<entry_body> causes freezing of each entity and profile
declared before it within the same @fa<declarative_part>.
!corrigendum A.3.2(32.5/3)
!AI-0004-1
!AI-0263-1
@dinsa
@xhang<@xterm<Is_Space>
True if Item is a character with position 32 (' ') or 160 (No_Break_Space).>
@dinst
@xhang<@xterm<Is_NFKC>
True if Item could be present in a string normalized to Normalization
Form KC (as defined by Clause 21 of ISO/IEC 10646:2017); this includes
all characters except those with positions 160, 168, 170, 175, 178, 179,
180, 181, 184, 185, 186, 188, 189, and 190.>
!corrigendum A.3.5(51/3)
!AI-0004-1
!AI-0263-1
@dinsa
@xindent<Returns True if the Wide_Character designated by Item is categorized as
@fa<separator_space>, otherwise returns False.>
@dinss
@xcode<@b<function> Is_NFKC (Item : Wide_Character) @b<return> Boolean;>
@xindent<Returns True if the Wide_Character designated by Item could be present
in a string normalized to Normalization Form KC (as defined by Clause
21 of ISO/IEC 10646:2017), otherwise returns False.>
!corrigendum A.4.3(5)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Fixed @b<is>
@b<pragma> Preelaborate(Fixed);>
@dby
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Fixed
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.4.4(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Bounded @b<is>
@b<pragma> Preelaborate(Bounded);>
@dby
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Bounded
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.4.5(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Unbounded @b<is>
@b<pragma> Preelaborate(Unbounded);>
@dby
@xcode<@b<with> Ada.Strings.Maps;
@b<package> Ada.Strings.Unbounded
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.4.7(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Strings.Wide_Maps @b<is>
@b<pragma> Preelaborate(Wide_Maps);>
@dby
@xcode<@b<package> Ada.Strings.Wide_Maps
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.4.8(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Strings.Wide_Wide_Maps @b<is>
@b<pragma> Preelaborate(Wide_Wide_Maps);>
@dby
@xcode<@b<package> Ada.Strings.Wide_Wide_Maps
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.4.9(7/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Containers;
@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String)
@b<return> Containers.Hash_Type;
@b<pragma> Preelaborate(Ada.Strings.Bounded.Hash);>
@dby
@xcode<@b<with> Ada.Containers;
@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String)
@b<return> Containers.Hash_Type
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.9(10/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Unbounded.Hash (Key : Unbounded_String)
@b<return> Containers.Hash_Type;
@b<pragma> Preelaborate(Ada.Strings.Unbounded.Hash);>
@dby
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Unbounded.Hash (Key : Unbounded_String)
@b<return> Containers.Hash_Type
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.9(11.7/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Containers;
@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Hash_Case_Insensitive
(Key : Bounded.Bounded_String) @b<return> Containers.Hash_Type;
@b<pragma> Preelaborate(Ada.Strings.Bounded.Hash_Case_Insensitive);>
@dby
@xcode<@b<with> Ada.Containers;
@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Hash_Case_Insensitive
(Key : Bounded.Bounded_String) @b<return> Containers.Hash_Type
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.9(11.10/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Unbounded.Hash_Case_Insensitive
(Key : Unbounded_String) @b<return> Containers.Hash_Type;
@b<pragma> Preelaborate(Ada.Strings.Unbounded.Hash_Case_Insensitive);>
@dby
@xcode<@b<with> Ada.Containers;
@b<function> Ada.Strings.Unbounded.Hash_Case_Insensitive
(Key : Unbounded_String) @b<return> Containers.Hash_Type
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.10(7/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Equal_Case_Insensitive
(Left, Right : Bounded.Bounded_String) @b<return> Boolean;
@b<pragma> Preelaborate(Ada.Strings.Bounded.Equal_Case_Insensitive);>
@dby
@xcode<@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Equal_Case_Insensitive
(Left, Right : Bounded.Bounded_String) @b<return> Boolean
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.10(10/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<function> Ada.Strings.Unbounded.Equal_Case_Insensitive
(Left, Right : Unbounded_String) @b<return> Boolean;
@b<pragma> Preelaborate(Ada.Strings.Unbounded.Equal_Case_Insensitive);>
@dby
@xcode<@b<function> Ada.Strings.Unbounded.Equal_Case_Insensitive
(Left, Right : Unbounded_String) @b<return> Boolean
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.10(18/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Less_Case_Insensitive
(Left, Right : Bounded.Bounded_String) @b<return> Boolean;
@b<pragma> Preelaborate(Ada.Strings.Bounded.Less_Case_Insensitive);>
@dby
@xcode<@b<generic>
@b<with package> Bounded @b<is>
@b<new> Ada.Strings.Bounded.Generic_Bounded_Length (<@>);
@b<function> Ada.Strings.Bounded.Less_Case_Insensitive
(Left, Right : Bounded.Bounded_String) @b<return> Boolean
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.4.10(21/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<function> Ada.Strings.Unbounded.Less_Case_Insensitive
(Left, Right : Unbounded_String) @b<return> Boolean;
@b<pragma> Preelaborate(Ada.Strings.Unbounded.Less_Case_Insensitive);>
@dby
@xcode<@b<function> Ada.Strings.Unbounded.Less_Case_Insensitive
(Left, Right : Unbounded_String) @b<return> Boolean
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized>;>
!corrigendum A.5.2(20)
!AI-0144-1
!AI-0302-1
@drepl
@xcode< @b<function> Random (Gen : Generator) @b<return> Result_Subtype;>
@dby
@xcode< @b<function> Random (Gen : Generator) @b<return> Result_Subtype
@b<with> Global =@> @b<overriding in out> Gen;>
@xcode< @b<function> Random (Gen : Generator;
First : Result_Subtype;
Last : Result_Subtype) @b<return> Result_Subtype
@b<with> Post =@> Random'Result @b<in> First .. Last
Global =@> @b<overriding in out> Gen;>
!corrigendum A.5.6(0)
!AI-0208-1
!AI-0302-1
!AI-0366-1
@dinsc
@s8<@i<Static Semantics>>
The library package Numerics.Big_Numbers.Big_Integers has the
following declaration:
@xcode<@b<with> Ada.Strings.Text_Buffers;
@b<package> Ada.Numerics.Big_Numbers.Big_Integers
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
@xcode< @b<type> Big_Integer @b<is private>
@b<with> Integer_Literal =@> From_String,
Put_Image =@> Put_Image;>
@xcode< @b<function> Is_Valid (Arg : Big_Integer) @b<return> Boolean
@b<with> Convention =@> Intrinsic;>
@xcode< @b<subtype> Valid_Big_Integer @b<is> Big_Integer
@b<with> Dynamic_Predicate =@> Is_Valid (Valid_Big_Integer),
Predicate_Failure =@> (@b<raise> Program_Error);>
@xcode< @b<function> "=" (L, R : Valid_Big_Integer) @b<return> Boolean;
@b<function> "<" (L, R : Valid_Big_Integer) @b<return> Boolean;
@b<function> "<=" (L, R : Valid_Big_Integer) @b<return> Boolean;
@b<function> "@>" (L, R : Valid_Big_Integer) @b<return> Boolean;
@b<function> "@>=" (L, R : Valid_Big_Integer) @b<return> Boolean;>
@xcode< @b<function> To_Big_Integer (Arg : Integer) @b<return> Valid_Big_Integer;>
@xcode< @b<subtype> Big_Positive @b<is> Big_Integer
@b<with> Dynamic_Predicate =@> (@b<if> Is_Valid (Big_Positive) @b<then> Big_Positive @> 0),
Predicate_Failure =@> (@b<raise> Constraint_Error);>
@xcode< @b<subtype> Big_Natural @b<is> Big_Integer
@b<with> Dynamic_Predicate =@> (@b<if> Is_Valid (Big_Natural) @b<then> Big_Natural @>= 0),
Predicate_Failure =@> (@b<raise> Constraint_Error);>
@xcode< @b<function> In_Range (Arg, Low, High : Valid_Big_Integer) @b<return> Boolean @b<is>
(Low <= Arg @b<and> Arg <= High);>
@xcode< @b<function> To_Integer (Arg : Valid_Big_Integer) @b<return> Integer
@b<with> Pre =@> In_Range (Arg,
Low =@> To_Big_Integer (Integer'First),
High =@> To_Big_Integer (Integer'Last))
@b<or else> @b<raise> Constraint_Error;>
@xcode< @b<generic>
@b<type> Int @b<is range> <@>;
@b<package> Signed_Conversions @b<is>
@b<function> To_Big_Integer (Arg : Int) @b<return> Valid_Big_Integer;
@b<function> From_Big_Integer (Arg : Valid_Big_Integer) @b<return> Int
@b<with> Pre =@> In_Range (Arg,
Low =@> To_Big_Integer (Int'First),
High =@> To_Big_Integer (Int'Last))
@b<or else> @b<raise> Constraint_Error;
@b<end> Signed_Conversions;>
@xcode< @b<generic>
@b<type> Int @b<is mod> <@>;
@b<package> Unsigned_Conversions @b<is>
@b<function> To_Big_Integer (Arg : Int) @b<return> Valid_Big_Integer;
@b<function> From_Big_Integer (Arg : Valid_Big_Integer) @b<return> Int
@b<with> Pre =@> In_Range (Arg,
Low =@> To_Big_Integer (Int'First),
High =@> To_Big_Integer (Int'Last))
@b<or else> @b<raise> Constraint_Error;
@b<end> Unsigned_Conversions;>
@xcode< @b<function> To_String (Arg : Valid_Big_Integer;
Width : Field := 0;
Base : Number_Base := 10) @b<return> String
@b<with> Post =@> To_String'Result'First = 1;>
@xcode< @b<function> From_String (Arg : String) @b<return> Valid_Big_Integer;>
@xcode< @b<procedure> Put_Image
(Buffer : @b<in out> Ada.Strings.Text_Buffers.Root_Buffer_Type'Class;
Arg : @b<in> Valid_Big_Integer);>
@xcode< @b<function> "+" (L : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "-" (L : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "abs" (L : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "+" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "-" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "*" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "/" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "mod" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "rem" (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> "**" (L : Valid_Big_Integer; R : Natural)
@b<return> Valid_Big_Integer;
@b<function> Min (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;
@b<function> Max (L, R : Valid_Big_Integer) @b<return> Valid_Big_Integer;>
@xcode< @b<function> Greatest_Common_Divisor
(L, R : Valid_Big_Integer) @b<return> Big_Positive
@b<with> Pre =@> (L /= 0 @b<and> R /= 0) @b<or else> @b<raise> Constraint_Error;>
@xcode<@b<private>
... -- @ft<@i<not specified by the language>>
@b<end> Ada.Numerics.Big_Numbers.Big_Integers;>
To_String and From_String behave analogously to the Put and Get procedures
defined in Text_IO.Integer_IO (in particular, with respect to the
interpretation of the Width and Base parameters) except that
Constraint_Error, not Data_Error, is propagated in error cases
and the result of a call To_String with a Width parameter of 0 and
a nonnegative Arg parameter does not include a leading blank.
Put_Image calls To_String (passing in the default values for the Width and
Base parameters), prepends a leading blank if the argument is
nonnegative, and writes the resulting value to the buffer using
Text_Buffers.Put.
The other functions have their usual mathematical meanings.
The type Big_Integer needs finalization (see 7.6).
@s8<@i<Dynamic Semantics>>
for purposes of determining whether predicate checks are performed
as part of default initialization, the type Big_Integer
is considered to have a subcomponent that has a @fa<default_expression>.
@s8<@i<Implementation Requirements>>
No storage associated with a Big_Integer object shall be lost upon
assignment or scope exit.
!corrigendum A.5.7(0)
!AI-0208-1
!AI-0302-1
!AI-0366-1
@dinsc
@s8<@i<Static Semantics>>
The library package Numerics.Big_Numbers.Big_Reals has the
following declaration:
@xcode<@b<with> Ada.Numerics.Big_Numbers.Big_Integers;
@b<use all type> Big_Integers.Big_Integer;
@b<with> Ada.Strings.Text_Buffers;
@b<package> Ada.Numerics.Big_Numbers.Big_Reals
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
@xcode< @b<type> Big_Real @b<is private>
@b<with> Real_Literal =@> From_String,
Put_Image =@> Put_Image;>
@xcode< @b<function> Is_Valid (Arg : Big_Real) @b<return> Boolean
@b<with> Convention =@> Intrinsic;>
@xcode< @b<subtype> Valid_Big_Real @b<is> Big_Real
@b<with> Dynamic_Predicate =@> Is_Valid (Valid_Big_Real),
Predicate_Failure =@> @b<raise> Program_Error;>
@xcode< @b<function> "/" (Num, Den : Big_Integers.Valid_Big_Integer)
@b<return> Valid_Big_Real
@b<with> Pre =@> Den /= 0
@b<or else raise> Constraint_Error;>
@xcode< @b<function> Numerator
(Arg : Valid_Big_Real) @b<return> Big_Integers.Valid_Big_Integer
@b<with> Post =@> (@b<if> Arg = 0.0 @b<then> Numerator'Result = 0);>
@xcode< @b<function> Denominator (Arg : Valid_Big_Real)
@b<return> Big_Integers.Big_Positive
@b<with> Post =@>
(@b<if> Arg = 0.0 @b<then> Denominator'Result = 1
@b<else> Big_Integers.Greatest_Common_Divisor
(Numerator (Arg), Denominator'Result) = 1);>
@xcode< @b<function> To_Big_Real (Arg : Big_Integers.Valid_Big_Integer)
@b<return> Valid_Big_Real @b<is> (Arg / 1);>
@xcode< @b<function> To_Real (Arg : Integer) @b<return> Valid_Big_Real @b<is>
(Big_Integers.To_Big_Integer (Arg) / 1);>
@xcode< @b<function> "=" (L, R : Valid_Big_Real) @b<return> Boolean;
@b<function> "<" (L, R : Valid_Big_Real) @b<return> Boolean;
@b<function> "<=" (L, R : Valid_Big_Real) @b<return> Boolean;
@b<function> "@>" (L, R : Valid_Big_Real) @b<return> Boolean;
@b<function> "@>=" (L, R : Valid_Big_Real) @b<return> Boolean;>
@xcode< @b<function> In_Range (Arg, Low, High : Valid_Big_Real) @b<return> Boolean @b<is>
(Low <= Arg @b<and> Arg <= High);>
@xcode< @b<generic>
@b<type> Num @b<is digits> <@>;
@b<package> Float_Conversions @b<is>
@b<function> To_Big_Real (Arg : Num) @b<return> Valid_Big_Real;
@b<function> From_Big_Real (Arg : Valid_Big_Real) @b<return> Num
@b<with> Pre =@> In_Range (Arg,
Low =@> To_Big_Real (Num'First),
High =@> To_Big_Real (Num'Last))
@b<or else> (@b<raise> Constraint_Error);
@b<end> Float_Conversions;>
@xcode< @b<generic>
@b<type> Num @b<is delta> <@>;
@b<package> Fixed_Conversions @b<is>
@b<function> To_Big_Real (Arg : Num) @b<return> Valid_Big_Real;
@b<function> From_Big_Real (Arg : Valid_Big_Real) @b<return> Num
@b<with> Pre =@> In_Range (Arg,
Low =@> To_Big_Real (Num'First),
High =@> To_Big_Real (Num'Last))
@b<or else> (@b<raise> Constraint_Error);
@b<end> Fixed_Conversions;>
@xcode< @b<function> To_String (Arg : Valid_Big_Real;
Fore : Field := 2;
Aft : Field := 3;
Exp : Field := 0) @b<return> String
@b<with> Post =@> To_String'Result'First = 1;>
@xcode< @b<function> From_String (Arg : String) @b<return> Valid_Big_Real;>
@xcode< @b<function> To_Quotient_String (Arg : Valid_Big_Real) @b<return> String @b<is>
(To_String (Numerator (Arg)) & " / " & To_String (Denominator (Arg)));
@b<function> From_Quotient_String (Arg : String) @b<return> Valid_Big_Real;>
@xcode< @b<procedure> Put_Image
(Buffer : @b<in out> Ada.Strings.Text_Buffers.Root_Buffer_Type'Class;
Arg : @b<in> Valid_Big_Real);>
@xcode< @b<function> "+" (L : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "-" (L : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "abs" (L : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "+" (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "-" (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "*" (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "/" (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> "**" (L : Valid_Big_Real; R : Integer)
@b<return> Valid_Big_Real;
@b<function> Min (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;
@b<function> Max (L, R : Valid_Big_Real) @b<return> Valid_Big_Real;>
@xcode<@b<private>
... -- @ft<@i<not specified by the language>>
@b<end> Ada.Numerics.Big_Numbers.Big_Reals;>
To_String and From_String behave analogously to the Put and Get procedures
defined in Text_IO.Float_IO (in particular, with respect to the
interpretation of the Fore, Aft, and Exp parameters), except that
Constraint_Error (not Data_Error) is propagated in error cases.
From_Quotient_String implements the inverse function of To_Quotient_String;
Constraint_Error is propagated in error cases. Put_Image calls To_String,
and writes the resulting value to the buffer using Text_Buffers.Put.
For an instance of Float_Conversions or Fixed_Conversions, To_Big_Real
is exact (that is, the result represents exactly the same
mathematical value as the argument) and From_Big_Real is subject to
the same precision rules as a type conversion of a value of type T to
the target type Num, where T is a hypothetical floating point type whose
model numbers include all of the model numbers of Num as well as the
exact mathematical value of the argument.
The other functions have their usual mathematical meanings.
The type Big_Real needs finalization (see 7.6).
@s8<@i<Dynamic Semantics>>
for purposes of determining whether predicate checks are performed as
part of default initialization, the type Big_Real is considered to have
a subcomponent that has a @fa<default_expression>.
@s8<@i<Implementation Requirements>>
No storage associated with a Big_Real object shall be lost
upon assignment or scope exit.
!corrigendum A.15(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Command_Line @b<is>
@b<pragma> Preelaborate(Command_Line);>
@dby
@xcode<@b<package> Ada.Command_Line
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.16.1(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Directories.Hierarchical_File_Names @b<is>>
@dby
@xcode<@b<package> Ada.Directories.Hierarchical_File_Names
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.17(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Environment_Variables @b<is>
@b<pragma> Preelaborate(Environment_Variables);>
@dby
@xcode<@b<package> Ada.Environment_Variables
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum A.18(2/2)
!AI-0111-1
!AI-0196-1
@drepl
A variety of sequence and associative containers are provided. Each container
includes a @i<cursor> type. A cursor is a reference to an element within a
container. Many operations on cursors are common to all of the containers. A
cursor referencing an element in a container is considered to be overlapping
with the container object itself.
@dby
A variety of sequence and associative containers are provided. Each container
includes a @i<cursor> type. A cursor is a reference to an element within a
container. Many operations on cursors are common to all of the containers. A
cursor referencing an element in a container is considered to be overlapping
only with the element itself.
!corrigendum A.18(10/2)
!AI-0112-1
!AI-0258-1
@dinsa
@xbullet<finalization of the collection of the access type has started if and
only if the finalization of the instance has started.>
@dinss
@s8<@i<Implementation Requirements>>
For an indefinite container (one whose type is defined in an instance of a
child package of Containers whose @fa<defining_identifier> contains "Indefinite"),
each element of the container shall be created when it is inserted into the
container and finalized when it is deleted from the container (or when the
container object is finalized if the element has not been deleted). For a
bounded container (one whose type is defined in an instance of a child
package of Containers whose @fa<defining_identifier> starts with "Bounded") that
is not an indefinite container, all of the elements of the capacity of the
container shall be created and default initialized when the container object
is created; the elements shall be finalized when the container object is
finalized. For other kinds of containers, when elements are created
and finalized is unspecified.
For an instance @i<I> of a container package with a container type @i<C>, the
specific type @i<T> of the object returned from a function that returns an
object of an iterator interface, as well as the primitive operations of @i<T>,
shall be nonblocking. The Global aspect specified for @i<T> and the primitive
operations of @i<T> shall be @fc<(@b<in all>, @b<out synchronized>)> or
a specification that allows access to fewer global objects.
!corrigendum A.18.2(8/3)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> Vector @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Vector);>
@dby
@xcode< @b<type> Vector @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Vector,
Aggregate =@> (Empty =@> Empty,
Add_Unnamed =@> Append_One,
New_Indexed =@> New_Vector,
Assign_Indexed =@> Replace_Element),
Stable_Properties =@> (Length, Capacity,
Tampering_With_Cursors_Prohibited,
Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Vector) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Vector)) @b<and then>
(@b<not> Tampering_With_Elements_Prohibited (Vector));
@b<pragma> Preelaborable_Initialization(Vector);>
!corrigendum A.18.2(12/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : Vector) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Vector) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Tampering_With_Elements_Prohibited
(Container : Vector) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Maximum_Length @b<return> Count_Type
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty (Capacity : Count_Type := @ft<@i<implementation-defined>>)
@b<return> Vector
@b<with> Pre =@> Capacity <= Maximum_Length @b<or else raise> Constraint_Error,
Post =@>
Capacity (Empty'Result) @>= Capacity @b<and then>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.2(14/2)
!AI-0112-1
!AI-0212-1
@drepl
@xcode< @b<function> To_Vector
(New_Item : Element_Type;
Length : Count_Type) @b<return> Vector>
@dby
@xcode< @b<function> To_Vector
(New_Item : Element_Type;
Length : Count_Type) @b<return> Vector
@b<with> Pre =@> Length <= Maximum_Length @b<or else raise> Constraint_Error,
Post =@>
To_Vector'Result.Length = Length @b<and then>
@b<not> Tampering_With_Elements_Prohibited (To_Vector'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (To_Vector'Result) @b<and then>
To_Vector'Result.Capacity @>= Length;>
@xcode< @b<function> New_Vector (First, Last : Index_Type) @b<return> Vector @b<is>
(To_Vector (Count_Type (Last - First + 1)))
@b<with> Pre =@> First = Index_Type'First;>
!corrigendum A.18.2(47/2)
!AI-0112-1
!AI-0212-1
@dinsa
@xcode< @b<procedure> Append (Container : @b<in out> Vector;
New_Item : @b<in> Element_Type;
Count : @b<in> Count_Type := 1);>
@dinst
@xcode< @b<procedure> Append_One (Container : @b<in out> Vector;
New_Item : @b<in> Element_Type)
@b<with> Pre =@> (@b<not> Tampering_With_Cursors_Prohibited (Container)
@b<or else raise> Program_Error) @b<and then>
(Length (Container) <= Maximum_Length - 1
@b<or else raise> Constraint_Error),
Post =@> Length (Container)'Old + 1 = Length (Container) @b<and then>
Capacity (Container) @>= Length (Container);>
!corrigendum A.18.2(74.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Vector)
@b<return> Vector_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Vector)
@b<return> Vector_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.2(98/3)
!AI-0112-1
!AI-0339-1
@dinsa
@xindent<If Left and Right denote the same vector object, then the function
returns True. If Left and Right have different lengths, then the function
returns False. Otherwise, it compares each element in Left to the
corresponding element in Right using the generic formal equality operator.
If any such comparison returns False, the function returns False; otherwise,
it returns True. Any exception raised during evaluation of element equality is
propagated.>
@dinss
@xcode<@b<function> Tampering_With_Cursors_Prohibited
(Container : Vector) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xindent<Returns True if tampering with cursors or tampering with elements is
currently prohibited for Container, and returns False otherwise.>
@xcode<@b<function> Tampering_With_Elements_Prohibited
(Container : Vector) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xindent<Always returns False, regardless of whether tampering with elements
is prohibited.>
@xcode<@b<function> Maximum_Length @b<return> Count_Type
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xindent<Returns the maximum Length of a Vector, based on the index type.>
@xcode<@b<function> Empty (Capacity : Count_Type := @ft<@i<implementation-defined>>)
@b<return> Vector
@b<with> Pre =@> Capacity <= Maximum_Length @b<or else raise> Constraint_Error,
Post =@> Capacity (Empty'Result) @>= Capacity @b<and then>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
@xindent<Returns an empty vector.>
!corrigendum A.18.2(125/2)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Index is not in the range First_Index (Container) .. Last_Index
(Container), then No_Element is returned. Otherwise, a cursor designating the
element at position Index in Container is returned.>
@dby
@xindent<Returns a cursor designating the
element at position Index in Container;
returns No_Element if Index does not designate an element. For the purposes of
determining whether the parameters overlap in a call to To_Cursor, the
Container parameter is not considered to overlap with any object (including
itself).>
!corrigendum A.18.2(133/3)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Index is not in the range First_Index (Container) .. Last_Index (Container),
then Constraint_Error is propagated. Otherwise, Replace_Element assigns the
value New_Item to the element at position Index. Any exception raised during
the assignment is propagated. The element at position Index is not an empty
element after successful call to Replace_Element.>
@dby
@xindent<Replace_Element assigns the
value New_Item to the element at position Index. Any exception raised during
the assignment is propagated. The element at position Index is not an empty
element after successful call to Replace_Element. For the purposes of
determining whether the parameters overlap in a call to Replace_Element, the
Container parameter is not considered to overlap with any object (including
itself), and the Index parameter is considered to overlap with the element at
position Index.>
!corrigendum A.18.2(135/3)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated;
if Position does not designate an element in Container, then Program_Error is
propagated. Otherwise, Replace_Element assigns New_Item to the element
designated by Position. Any exception raised during the assignment is
propagated. The element at Position is not an empty element after successful
call to Replace_Element.>
@dby
@xindent<Replace_Element assigns New_Item to the element
designated by Position. Any exception raised during the assignment is
propagated. The element at Position is not an empty element after successful
call to Replace_Element. For the purposes of determining whether the parameters
overlap in a call to Replace_Element, the Container parameter is not considered
to overlap with any object (including itself).>
!corrigendum A.18.2(175/2)
!AI-0112-1
!AI-0212-1
@dinsa
@xindent<Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, Count).>
@dinss
@xcode<@b<procedure> Append_One (Container : @b<in out> Vector;
New_Item : @b<in> Element_Type)
@b<with> Pre =@> (@b<not> Tampering_With_Cursors_Prohibited (Container)
@b<or else raise> Program_Error) @b<and then>
(Length (Container) <= Maximum_Length - 1
@b<or else raise> Constraint_Error),
Post =@> Length (Container)'Old + 1 = Length (Container) @b<and then>
Capacity (Container) @>= Length (Container);>
@xindent<Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, 1).>
!corrigendum A.18.2(230.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Vector)
@b<return> Vector_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Vector)
@b<return> Vector_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.3(6/3)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> List @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(List);>
@dby
@xcode< @b<type> List @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.List,
Aggregate =@> (Empty =@> Empty,
Add_Unnamed =@> Append),
Stable_Properties =@> (Length,
Tampering_With_Cursors_Prohibited,
Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (List) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (List)) @b<and then>
(@b<not> Tampering_With_Elements_Prohibited (List));
@b<pragma> Preelaborable_Initialization(List);>
!corrigendum A.18.3(10/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : List) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : List) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Tampering_With_Elements_Prohibited
(Container : List) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty @b<return> List
@b<is> (Empty_List)
@b<with> Post =@>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.3(46.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> List)
@b<return> List_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> List)
@b<return> List_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.3(81/3)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated;
if Position does not designate an element in Container, then Program_Error is
propagated. Otherwise, Replace_Element assigns the value New_Item to the
element designated by Position.>
@dby
@xindent<Replace_Element assigns the value New_Item to the
element designated by Position. For the purposes of determining whether the
parameters overlap in a call to Replace_Element, the Container parameter is
not considered to overlap with any object (including itself).>
!corrigendum A.18.3(144.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> List)
@b<return> List_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> List)
@b<return> List_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.4(36/3)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated;
if Position does not designate an element in Container, then Program_Error
is propagated. Otherwise, Replace_Element assigns New_Item to the element of
the node designated by Position.>
@dby
@xindent<Replace_Element assigns New_Item to the element of
the node designated by Position. For the purposes of determining whether the
parameters overlap in a call to Replace_Element, the Container parameter is
not considered to overlap with any object (including itself).>
!corrigendum A.18.5(3/2)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> Map @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Map);>
@dby
@xcode< @b<type> Map @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Map,
Aggregate =@> (Empty =@> Empty,
Add_Named =@> Insert),
Stable_Properties =@> (Length,
Tampering_With_Cursors_Prohibited,
Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Map) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Map)) @b<and then>
(@b<not> Tampering_With_Elements_Prohibited (Map));
@b<pragma> Preelaborable_Initialization(Map);>
!corrigendum A.18.5(7/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : Map) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Map) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Tampering_With_Elements_Prohibited
(Container : Map) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty (Capacity : Count_Type := @ft<@i<implementation-defined>>)
@b<return> Map
@b<with> Post =@>
Capacity (Empty'Result) @>= Capacity @b<and then>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.5(37.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.5(61.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.6(4/3)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> Map @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Map);>
@dby
@xcode< @b<type> Map @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Map,
Aggregate =@> (Empty =@> Empty,
Add_Named =@> Insert),
Stable_Properties =@> (Length,
Tampering_With_Cursors_Prohibited,
Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Map) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Map)) @b<and then>
(@b<not> Tampering_With_Elements_Prohibited (Map));
@b<pragma> Preelaborable_Initialization(Map);>
!corrigendum A.18.6(7/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : Map) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Map) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Tampering_With_Elements_Prohibited
(Container : Map) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty @b<return> Map
@b<is> (Empty_Map)
@b<with> Post =@>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.6(51.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.6(94.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Map)
@b<return> Map_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.7(34/2)
!AI-0112-1
!AI-0196-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated;
if Position does not designate an element in Container, then Program_Error
is propagated. If an element equivalent to New_Item is already present in
Container at a position other than Position, Program_Error is propagated.
Otherwise, Replace_Element assigns New_Item to the element designated by
Position. Any exception raised by the assignment is propagated.>
@dby
@xindent<Replace_Element assigns New_Item to the element designated by
Position. Any exception raised by the assignment is propagated. For the
purposes of determining whether the parameters overlap in a call to
Replace_Element, the Container parameter is not considered to overlap with
any object (including itself).>
!corrigendum A.18.8(3/3)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> Set @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Set);>
@dby
@xcode< @b<type> Set @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Set,
Aggregate =@> (Empty =@> Empty,
Add_Unnamed =@> Include),
Stable_Properties =@> (Length,
Tampering_With_Cursors_Prohibited),
Default_Initial_Condition =@>
Length (Set) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Set));
@b<pragma> Preelaborable_Initialization(Set);>
!corrigendum A.18.8(8/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> Equivalent_Sets (Left, Right : Set) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Set) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty (Capacity : Count_Type := @ft<@i<implementation-defined>>)
@b<return> Set
@b<with> Post =@>
Capacity (Empty'Result) @>= Capacity @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.8(49.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.8(85.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.9(4/3)
!AI-0111-1
!AI-0112-1
!AI-0212-1
!AI-0339-1
@drepl
@xcode< @b<type> Set @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Set);>
@dby
@xcode< @b<type> Set @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Set,
Aggregate =@> (Empty =@> Empty,
Add_Unnamed =@> Include),
Stable_Properties =@> (Length,
Tampering_With_Cursors_Prohibited),
Default_Initial_Condition =@>
Length (Set) = 0 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Set));
@b<pragma> Preelaborable_Initialization(Set);>
!corrigendum A.18.9(9/2)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> Equivalent_Sets (Left, Right : Set) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Set) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty @b<return> Set
@b<is> (Empty_Set)
@b<with> Post =@>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.9(61.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.9(113.1/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Set)
@b<return> Set_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(8/3)
!AI-0111-1
!AI-0112-1
@drepl
@xcode< @b<type> Tree @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type;
@b<pragma> Preelaborable_Initialization(Tree);>
@dby
@xcode< @b<type> Tree @b<is tagged private>
@b<with> Constant_Indexing =@> Constant_Reference,
Variable_Indexing =@> Reference,
Default_Iterator =@> Iterate,
Iterator_Element =@> Element_Type,
Iterator_View =@> Stable.Tree,
Stable_Properties =@> (Node_Count,
Tampering_With_Cursors_Prohibited,
Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Node_Count (Tree) = 1 @b<and then>
(@b<not> Tampering_With_Cursors_Prohibited (Tree)) @b<and then>
(@b<not> Tampering_With_Elements_Prohibited (Tree));
@b<pragma> Preelaborable_Initialization(Tree);>
!corrigendum A.18.10(15/3)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : Tree) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_Cursors_Prohibited
(Container : Tree) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Tampering_With_Elements_Prohibited
(Container : Tree) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty @b<return> Tree
@b<is> (Empty_Tree)
@b<with> Post =@>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Node_Count (Empty'Result) = 1;>
!corrigendum A.18.10(44/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate (Container : @b<in> Tree)
@b<return> Tree_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode< @b<function> Iterate (Container : @b<in> Tree)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(45/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate_Subtree (Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode< @b<function> Iterate_Subtree (Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Pre =@> Position /= No_Element @b<or else raise> Constraint_Error,
Global =@> (@b<in all>, @b<use null>);>
@xcode< @b<function> Iterate_Subtree (Container : @b<in> Tree; Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Pre =@> (Position /= No_Element
@b<or else raise> Constraint_Error) @b<and then>
(Meaningful_For (Container, Position)
@b<or else raise> Program_Error),
Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(70/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode< @b<function> Iterate_Children (Container : @b<in> Tree; Parent : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode< @b<function> Iterate_Children (Container : @b<in> Tree; Parent : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Pre =@> (Parent /= No_Element
@b<or else raise> Constraint_Error) @b<and then>
(Meaningful_For (Container, Parent)
@b<or else raise> Program_Error),
Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(116/3)
!AI-0112-1
!AI-0266-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated;
if Position does not designate an element in Container (including if it
designates the root node), then Program_Error is propagated. Otherwise,
Replace_Element assigns the value New_Item to the element designated by
Position.>
@dby
@xindent<Replace_Element assigns the value New_Item to the element designated by
Position. For the purposes of determining whether the parameters overlap in a
call to Replace_Element, the Container parameter is not considered to overlap
with any object (including itself).>
!corrigendum A.18.10(156/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate (Container : @b<in> Tree)
@b<return> Tree_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode<@b<function> Iterate (Container : @b<in> Tree)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(158/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate_Subtree (Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Forward_Iterator'Class;>
@dby
@xcode<@b<function> Iterate_Subtree (Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Pre =@> Position /= No_Element @b<or else raise> Constraint_Error,
Global =@> (@b<in all>, @b<use null>);>
!corrigendum A.18.10(159/3)
!AI-0112-1
!AI-0266-1
@drepl
@xindent<If Position equals No_Element, then Constraint_Error is propagated. Otherwise,
Iterate_Subtree returns an iterator object (see 5.5.1) that will generate a value for
a loop parameter (see 5.5.2) designating each element in the subtree rooted by the node
designated by Position, starting from the node designated by Position and
proceeding in a depth-first order. If Position equals No_Element, then Constraint_Error is
propagated. Tampering with the cursors of the container that contains the node designated
by Position is prohibited while the iterator object
exists (in particular, in the @fa<sequence_of_statements> of the @fa<loop_statement>
whose @fa<iterator_specification> denotes this object). The iterator
object needs finalization.>
@dby
@xindent<Iterate_Subtree returns an iterator object (see 5.5.1) that
will generate a value for a loop parameter (see 5.5.2) designating each element
in the subtree rooted by the node designated by Position, starting
from the node designated by Position and
proceeding in a depth-first order when used as a forward iterator, and processing
all nodes in the subtree concurrently when used as a parallel iterator.
Tampering with the cursors of the container that contains the
node designated by Position is prohibited while the iterator object
exists (in particular, in the @fa<sequence_of_statements> of the
@fa<loop_statement> whose @fa<iterator_specification> denotes this object).
The iterator object needs finalization.>
@xcode<@b<function> Iterate_Subtree (Container : @b<in> Tree; Position : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Iterator'Class
@b<with> Pre =@> (Position /= No_Element
@b<or else raise> Constraint_Error) @b<and then>
(Meaningful_For (Container, Position)
@b<or else raise> Program_Error),
Post =@> Tampering_With_Cursors_Prohibited (Container);>
@xindent<Iterate_Subtree returns an iterator object (see 5.5.1) that
will generate a value for a loop parameter (see 5.5.2) designating each element
in the subtree rooted by the node designated by Position in Container, starting
from the node designated by Position and
proceeding in a depth-first order when used as a forward iterator, and processing
all nodes in the subtree concurrently when used as a parallel iterator.
Tampering with the cursors of the container that contains the
node designated by Position is prohibited while the iterator object
exists (in particular, in the @fa<sequence_of_statements> of the
@fa<loop_statement> whose @fa<iterator_specification> denotes this object).
The iterator object needs finalization.>
!corrigendum A.18.10(218/3)
!AI-0112-1
!AI-0266-1
@drepl
@xcode<@b<function> Iterate_Children (Container : @b<in> Tree; Parent : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Reversible_Iterator'Class;>
@dby
@xcode<@b<function> Iterate_Children (Container : @b<in> Tree; Parent : @b<in> Cursor)
@b<return> Tree_Iterator_Interfaces.Parallel_Reversible_Iterator'Class
@b<with> Pre =@> (Parent /= No_Element
@b<or else raise> Constraint_Error) @b<and then>
(Meaningful_For (Container, Parent)
@b<or else raise> Program_Error),
Post =@> Tampering_With_Cursors_Prohibited (Container);>
!corrigendum A.18.10(219/3)
!AI-0112-1
!AI-0266-1
@drepl
@xindent<Iterate_Children returns a reversible iterator object (see 5.5.1) that will generate a
value for a loop parameter (see 5.5.2) designating each child node of Parent. If Parent equals
No_Element, then Constraint_Error is propagated. If Parent does not designate a
node in Container, then Program_Error is propagated. Otherwise, when used as a forward iterator,
the nodes are designated starting with the first child node and
moving the cursor as per the function Next_Sibling; when used as a reverse
iterator, the nodes are designated starting with the last child node and
moving the cursor as per the function Previous_Sibling. Tampering with the cursors of
Container is prohibited while the iterator object exists (in particular,
in the @fa<sequence_of_statements> of the @fa<loop_statement> whose
@fa<iterator_specification> denotes this object).
The iterator object needs finalization.>
@dby
@xindent<Iterate_Children returns an iterator object (see 5.5.1) that will
generate a value for a loop parameter (see 5.5.2) designating each child node
of Parent. When used as a forward iterator,
the nodes are designated starting with the first child node and
moving the cursor as per the function Next_Sibling; when used as a reverse
iterator, the nodes are designated starting with the last child node and
moving the cursor as per the function Previous_Sibling; when used
as a parallel iterator, processing all child nodes concurrently. Tampering
with the cursors of
Container is prohibited while the iterator object exists (in particular,
in the @fa<sequence_of_statements> of the @fa<loop_statement> whose
@fa<iterator_specification> denotes this object).
The iterator object needs finalization.>
!corrigendum A.18.18(8/3)
!AI-0112-1
!AI-0339-1
@dinsa
@xcode< @b<function> "=" (Left, Right : Holder) @b<return> Boolean;>
@dinss
@xcode< @b<function> Tampering_With_The_Element_Prohibited
(Container : Holder) @b<return> Boolean
@b<with> Nonblocking, Global =@> (@b<null>, @b<use null>);>
@xcode< @b<function> Empty @b<return> Holder
@b<is> (Empty_Holder)
@b<with> Post =@>
@b<not> Tampering_With_The_Element_Prohibited (Empty'Result)
@b<and then> Is_Empty (Empty'Result);>
!corrigendum A.18.18(22/3)
!AI-0112-1
!AI-0350-1
@drepl
@xcode< @b<procedure> Move (Target : @b<in out> Holder; Source : @b<in out> Holder);>
@dby
@xcode< @b<procedure> Move (Target : @b<in out> Holder; Source : @b<in out> Holder)
@b<with> Pre =@> (@b<not> Tampering_With_The_Element_Prohibited (Target)
@b<or else raise> Program_Error) @b<and then>
(@b<not> Tampering_With_The_Element_Prohibited (Source)
@b<or else raise> Program_Error),
Post =@> (@b<if> Target /= Source @b<then>
Is_Empty (Source) @b<and then> (@b<not> Is_Empty (Target)));>
@xcode< @b<procedure> Swap (Left, Right : @b<in out> Holder)
@b<with> Pre =@> (@b<not> Tampering_With_The_Element_Prohibited (Left)
@b<or else raise> Program_Error) @b<and then>
(@b<not> Tampering_With_The_Element_Prohibited (Right)
@b<or else raise> Program_Error),
Post =@> Is_Empty (Left) = Is_Empty (Right)'Old @b<and then>
Is_Empty (Right) = Is_Empty (Left)'Old;>
!corrigendum A.18.18(67/3)
!AI-0112-1
!AI-0350-1
@drepl
@xindent<If Target denotes the same object as Source, then the operation has
no effect. Otherwise, the element contained by Source (if any) is removed from
Source and inserted into Target, replacing any preexisting content. Source is
empty after a successful call to Move.>
@dby
@xindent<If Target denotes the same object as Source, then the operation has
no effect. Otherwise, the element contained by Source (if any) is removed from
Source and inserted into Target, replacing any preexisting content.>
@xcode<@b<procedure> Swap (Left, Right : @b<in out> Holder)
@b<with> Pre =@> (@b<not> Tampering_With_The_Element_Prohibited (Left)
@b<or else raise> Program_Error) @b<and then>
(@b<not> Tampering_With_The_Element_Prohibited (Right)
@b<or else raise> Program_Error),
Post =@> Is_Empty (Left) = Is_Empty (Right)'Old @b<and then>
Is_Empty (Right) = Is_Empty (Left)'Old;>
@xindent<If Left denotes the same object as Right, then the operation has no effect.
Otherwise, operation exchanges the elements (if any) contained by Left and Right.>
!corrigendum A.18.19(6/3)
!AI-0112-1
!AI-0339-1
@dinsa
@xbullet<The type Vector needs finalization if and only if type Element_Type
needs finalization.>
@dinss
@xbullet<Capacity is omitted from the Stable_Properties of type Vector.>
@xbullet<In function Empty, the postcondition is altered to:>
@xcode< Post =@>
Empty'Result.Capacity = Capacity @b<and then>
@b<not> Tampering_With_Elements_Prohibited (Empty'Result) @b<and then>
@b<not> Tampering_With_Cursors_Prohibited (Empty'Result) @b<and then>
Length (Empty'Result) = 0;>
!corrigendum A.18.32(0)
!AI-0254-1
!AI-0350-1
@dinsc
The language-defined generic package Containers.Bounded_Indefinite_Holders
provides a private type Holder and a set of operations for that type. It
provides the same operations as the package Containers.Indefinite_Holders
(see A.18.18), with the difference that the maximum storage is bounded.
@s8<@i<Static Semantics>>
The declaration of the generic library package
Containers.Bounded_Indefinite_Holders has the same contents and semantics as
Containers.Indefinite_Holders except:
@xbullet<The following is added to the context clause:>
@xcode< @b<with> System.Storage_Elements; @b<use> System.Storage_Elements;>
@xbullet<An additional generic parameter follows Element_Type:>
@xcode< Max_Element_Size_in_Storage_Elements : Storage_Count;>
@xbullet<Add to the precondition of To_Holder and Replace_Element:>
@xcode< @b<and then> (New_Item'Size <=
Max_Element_Size_in_Storage_Elements * System.Storage_Unit
@b<or else raise> Program_Error)>
@s8<@i<Bounded (Run-Time) Errors>>
It is a bounded error to assign from a bounded holder object while tampering
with elements of that object is prohibited. Either Program_Error is raised by
the assignment, execution proceeds with the target object prohibiting tampering
with elements, or execution proceeds normally.
@s8<@i<Implementation Requirements>>
For each instance of Containers.Indefinite_Holders and each instance of
Containers.Bounded_Indefinite_Holders, if the two instances meet the following
conditions, then the output generated by the Holder'Output or Holder'Write
subprograms of either instance shall be readable by the Holder'Input or
Holder'Read of the other instance, respectively:
@xbullet<the Element_Type parameters of the two instances are statically
matching subtypes of the same type; and>
@xbullet<the output generated by Element_Type'Output or Element_Type'Write is
readable by Element_Type'Input or Element_Type'Read, respectively
(where Element_Type denotes the type of the two actual Element_Type
parameters).>
@s8<@i<Implementation Advice>>
Bounded holder objects should be implemented without dynamic allocation and
any finalization should be trivial unless Element_Type needs finalization.
The Implementation Advice about the Move and Swap operations is deleted for
bounded holders; these operations can copy elements as needed.
!corrigendum B.3.1(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Interfaces.C.Strings @b<is>
@b<pragma> Preelaborate(Strings);>
@dby
@xcode<@b<package> Interfaces.C.Strings
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum B.3.2(4)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<generic>
@b<type> Index @b<is> (<@>);
@b<type> Element @b<is private>;
@b<type> Element_Array @b<is array> (Index @b<range> <@>) @b<of aliased> Element;
Default_Terminator : Element;
@b<package> Interfaces.C.Pointers @b<is>
@b<pragma> Preelaborate(Pointers);>
@dby
@xcode<@b<generic>
@b<type> Index @b<is> (<@>);
@b<type> Element @b<is private>;
@b<type> Element_Array @b<is array> (Index @b<range> <@>) @b<of aliased> Element;
Default_Terminator : Element;
@b<package> Interfaces.C.Pointers
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum B.4(7)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Interfaces.COBOL @b<is>
@b<pragma> Preelaborate(COBOL);>
@dby
@xcode<@b<package> Interfaces.COBOL
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum B.5(21)
!AI-0058-1
!AI-0263-1
@drepl
An implementation may add additional declarations to the Fortran interface
packages. For example, the Fortran interface package for an implementation
of Fortran 77 (ANSI X3.9-1978) that defines types like Integer*@i<n>,
Real*@i<n>, Logical*@i<n>, and Complex*@i<n> may contain the declarations
of types named Integer_Star_@i<n>, Real_Star_@i<n>, Logical_Star_@i<n>, and
Complex_Star_@i<n>. (This convention should not apply to Character*@i<n>, for
which the Ada analog is the constrained array subtype Fortran_Character
(1..n).) Similarly, the Fortran interface package for an implementation of
Fortran 90 that provides multiple kinds of intrinsic types, e.g.
Integer (Kind=@i<n>), Real (Kind=@i<n>), Logical (Kind=@i<n>),
Complex (Kind=@i<n>), and Character (Kind=@i<n>), may contain the declarations
of types with the recommended names Integer_Kind_@i<n>, Real_Kind_@i<n>,
Logical_Kind_@i<n>, Complex_Kind_@i<n>, and Character_Kind_@i<n>.
@dby
An implementation may add additional declarations to the Fortran interface
packages. For example, declarations are permitted
for the character types corresponding to Fortran character kinds 'ascii' and
'iso_10646', which in turn correspond to ISO/IEC 646:1991 and
to UCS-4 as specified in ISO/IEC 10646:2017.
!corrigendum C.3.2(2/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> System;
@b<with> System.Multiprocessors;
@b<package> Ada.Interrupts @b<is>
@b<type> Interrupt_Id @b<is> @ft<@i<implementation-defined>>;
@b<type> Parameterless_Handler @b<is>
@b<access protected procedure>;>
@dby
@xcode<@b<with> System;
@b<with> System.Multiprocessors;
@b<package> Ada.Interrupts
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<type> Interrupt_Id @b<is> @ft<@i<implementation-defined>>;
@b<type> Parameterless_Handler @b<is>
@b<access protected procedure>
@b<with> Nonblocking =@> False;>
!corrigendum C.6(12/3)
!AI-0282-1
!AI-0363-1
@drepl
If an atomic object is passed as a parameter, then the formal
parameter shall either have an atomic type or allow pass by copy. If an
atomic object is used
as an actual for a generic formal object of mode @b<in out>, then the
type of the generic formal object shall be atomic. If the @fa<prefix> of
an @fa<attribute_reference> for an Access attribute denotes an atomic
object (including a component), then the designated type of
the resulting access type shall be atomic. If an atomic type is used as
an actual for a generic formal derived type, then the ancestor of the
formal type shall be atomic. Corresponding rules
apply to volatile objects and types.
@dby
If an atomic object is passed as a parameter, then the formal
parameter shall either have an atomic type or allow pass by copy. If
an atomic object is used as an actual for a generic formal object of
mode @b<in out>, then the type of the generic formal object shall be
atomic. If the @fa<prefix> of an @fa<attribute_reference> for an Access
attribute denotes an atomic object (including a component), then the
designated type of the resulting access type shall be atomic.
Corresponding rules apply to volatile objects and to full access
objects.
!corrigendum C.6(12.1/3)
!AI-0282-1
!AI-0363-1
@drepl
If a volatile type is used as an actual for a generic formal array
type, then the element type of the formal type shall be volatile.
@dby
If the Atomic, Atomic_Components, Volatile, Volatile_Components,
Independent, Independent_Components, or Full_Access_Only aspect is
True for a generic formal type, then that aspect shall be True for the
actual type. If an atomic type is used as an actual for a generic
formal derived type, then the ancestor of the formal type shall be
atomic. A corresponding rule applies to volatile types and similarly
to full access types.
If a type with volatile components is used as an actual for a generic
formal array type, then the components of the formal type shall be
volatile. Furthermore, if the actual type has atomic components and
the formal array type has aliased components, then the
components of the formal array type shall also be atomic. A corresponding
rule applies when the actual type has volatile full access components.
!corrigendum C.6(19)
!AI-0128-1
!AI-0347-1
!AI-0363-1
@dinsa
If an actual parameter is atomic or volatile, and the corresponding formal
parameter is not, then the parameter is passed by copy.
@dinst
All reads of or writes to any nonatomic subcomponent of a full access object
are performed by reading and/or writing all of the nearest
enclosing full access object.
!corrigendum C.6.4
!AI-0321-1
!AI-0364-1
@dinsc
The language-defined generic package System.Atomic_Operations.Integer_Arithmetic
provides operations to perform arithmetic atomically on objects of
integer types.
@s8<@i<Static Semantics>>
The generic library package System.Atomic_Operations.Integer_Arithmetic has the
following declaration:
@xcode<@b<generic>
@b<type> Atomic_Type @b<is range> <@> @b<with> Atomic;
@b<package> System.Atomic_Operations.Integer_Arithmetic
@b<with> Pure, Nonblocking @b<is>>
@xcode< @b<procedure> Atomic_Add (Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type)
@b<with> Convention =@> Intrinsic;>
@xcode< @b<procedure> Atomic_Subtract (Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type)
@b<with> Convention =@> Intrinsic;>
@xcode< @b<function> Atomic_Fetch_And_Add
(Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type) @b<return> Atomic_Type
@b<with> Convention =@> Intrinsic;>
@xcode< @b<function> Atomic_Fetch_And_Subtract
(Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type) @b<return> Atomic_Type
@b<with> Convention =@> Intrinsic;>
@xcode< @b<function> Is_Lock_Free (Item : @b<aliased> Atomic_Type) @b<return> Boolean
@b<with> Convention =@> Intrinsic;>
@xcode<@b<end> System.Atomic_Operations.Integer_Arithmetic;>
The operations of this package are defined as follows:
@xcode<@b<procedure> Atomic_Add (Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type)
@b<with> Convention =@> Intrinsic;>
@xindent<Atomically performs: @fc<Item := Item + Value;>>
@xcode<@b<procedure> Atomic_Subtract (Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type)
@b<with> Convention =@> Intrinsic;>
@xindent<Atomically performs: @fc<Item := Item - Value;>>
@xcode<@b<function> Atomic_Fetch_And_Add
(Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type) @b<return> Atomic_Type
@b<with> Convention =@> Intrinsic;>
@xindent<Atomically performs: @fc<Tmp := Item; Item := Item + Value; @b<return> Tmp;>>
@xcode<@b<function> Atomic_Fetch_And_Subtract
(Item : @b<aliased in out> Atomic_Type;
Value : Atomic_Type) @b<return> Atomic_Type
@b<with> Convention =@> Intrinsic;>
@xindent<Atomically performs: @fc<Tmp := Item; Item := Item - Value; @b<return> Tmp;>>
!corrigendum C.7.1(2/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Task_Identification @b<is>
@b<pragma> Preelaborate(Task_Identification);
@b<type> Task_Id @b<is private>;
@b<pragma> Preelaborable_Initialization (Task_Id);
Null_Task_Id : @b<constant> Task_Id;
@b<function> "=" (Left, Right : Task_Id) @b<return> Boolean;>
@dby
@xcode<@b<package> Ada.Task_Identification
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<type> Task_Id @b<is private>;
@b<pragma> Preelaborable_Initialization (Task_Id);
Null_Task_Id : @b<constant> Task_Id;
@b<function> "=" (Left, Right : Task_Id) @b<return> Boolean;>
!corrigendum C.7.2(2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Task_Identification; @b<use> Ada.Task_Identification;
@b<generic>
@b<type> Attribute @b<is private>;
Initial_Value : @b<in> Attribute;
@b<package> Ada.Task_Attributes @b<is>>
@dby
@xcode<@b<with> Ada.Task_Identification; @b<use> Ada.Task_Identification;
@b<generic>
@b<type> Attribute @b<is private>;
Initial_Value : @b<in> Attribute;
@b<package> Ada.Task_Attributes
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum C.7.3(2/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Task_Identification;
@b<with> Ada.Exceptions;
@b<package> Ada.Task_Termination @b<is>
@b<pragma> Preelaborate(Task_Termination);>
@dby
@xcode<@b<with> Ada.Task_Identification;
@b<with> Ada.Exceptions;
@b<package> Ada.Task_Termination
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.2.1(1.2/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Dispatching @b<is>
@b<pragma> Preelaborate(Dispatching);>
@dby
@xcode<@b<package> Ada.Dispatching
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.2.1(1.5/2)
!AI-0279-1
!AI-0294-1
@dinsa
Dispatching serves as the parent of other language-defined library
units concerned with task dispatching.
@dinss
For a noninstance subprogram (including a generic formal subprogram),
a generic subprogram, or an entry, the following language-defined aspect
may be specified with an @fa<aspect_specification> (see 13.1.1):
@xhang<@xterm<Yield>
The type of aspect Yield is Boolean.>
@xindent<If directly specified, the @fa<aspect_definition> shall be a static
expression. If not specified (including by inheritance), the aspect is False.>
@xindent<If a Yield aspect is specified True for a primitive subprogram @i<S>
of a type @i<T>, then the aspect is inherited by the corresponding primitive
subprogram of each descendant of @i<T>.>
@s8<@i<Legality Rules>>
If the Yield aspect is specified for a dispatching subprogram that inherits
the aspect, the specified value shall be confirming.
If the Nonblocking aspect (see 9.5) of the associated callable entity is
statically True, the Yield aspect shall not be specified as True. For a
callable entity that is declared within a generic body, this rule is checked
assuming that any nonstatic Nonblocking attributes in the expression of the
Nonblocking aspect of the entity are statically True.
In addition to the places where Legality Rules normally apply (see 12.3),
these rules also apply in the private part of an instance of a generic unit.
!corrigendum D.2.1(7/3)
!AI-0241-1
!AI-0279-1
!AI-0299-1
@drepl
A call of Yield is a task dispatching point. Yield is a potentially blocking
operation (see 9.5.1).
@dby
A call of Yield and a @fa<delay_statement> are task dispatching points for all
language-defined policies.
If the Yield aspect has the value True, then a call to procedure Yield is included
within the body of the associated callable entity, and invoked
immediately prior to returning from the body if and only if no other
task dispatching points were encountered during the execution of the
body.
!corrigendum D.2.4(2.2/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Dispatching.Non_Preemptive @b<is>
@b<pragma> Preelaborate(Non_Preemptive);
@b<procedure> Yield_To_Higher;
@b<procedure> Yield_To_Same_Or_Higher @b<renames> Yield;
@b<end> Ada.Dispatching.Non_Preemptive;>
@dby
@xcode<@b<package> Ada.Dispatching.Non_Preemptive
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<procedure> Yield_To_Higher;
@b<procedure> Yield_To_Same_Or_Higher @b<renames> Yield;
@b<end> Ada.Dispatching.Non_Preemptive;>
!corrigendum D.2.5(4/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> System;
@b<with> Ada.Real_Time;
@b<package> Ada.Dispatching.Round_Robin @b<is>
Default_Quantum : @b<constant> Ada.Real_Time.Time_Span :=
@ft<@i<implementation-defined>>;
@b<procedure> Set_Quantum (Pri : @b<in> System.Priority;
Quantum : @b<in> Ada.Real_Time.Time_Span);
@b<procedure> Set_Quantum (Low, High : @b<in> System.Priority;
Quantum : @b<in> Ada.Real_Time.Time_Span);
@b<function> Actual_Quantum (Pri : System.Priority)
@b<return> Ada.Real_Time.Time_Span;
@b<function> Is_Round_Robin (Pri : System.Priority) @b<return> Boolean;
@b<end> Ada.Dispatching.Round_Robin;>
@dby
@xcode<@b<with> System;
@b<with> Ada.Real_Time;
@b<package> Ada.Dispatching.Round_Robin
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
Default_Quantum : @b<constant> Ada.Real_Time.Time_Span :=
@ft<@i<implementation-defined>>;
@b<procedure> Set_Quantum (Pri : @b<in> System.Priority;
Quantum : @b<in> Ada.Real_Time.Time_Span);
@b<procedure> Set_Quantum (Low, High : @b<in> System.Priority;
Quantum : @b<in> Ada.Real_Time.Time_Span);
@b<function> Actual_Quantum (Pri : System.Priority)
@b<return> Ada.Real_Time.Time_Span;
@b<function> Is_Round_Robin (Pri : System.Priority) @b<return> Boolean;
@b<end> Ada.Dispatching.Round_Robin;>
!corrigendum D.2.6(9/2)
!AI-0230-1
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Real_Time;
@b<with> Ada.Task_Identification;
@b<package> Ada.Dispatching.EDF @b<is>
@b<subtype> Deadline @b<is> Ada.Real_Time.Time;
Default_Deadline : @b<constant> Deadline :=
Ada.Real_Time.Time_Last;
@b<procedure> Set_Deadline (D : @b<in> Deadline;
T : @b<in> Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
@b<procedure> Delay_Until_And_Set_Deadline (
Delay_Until_Time : @b<in> Ada.Real_Time.Time;
Deadline_Offset : @b<in> Ada.Real_Time.Time_Span);
@b<function> Get_Deadline (T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task) @b<return> Deadline;
@b<end> Ada.Dispatching.EDF;>
@dby
@xcode<@b<with> Ada.Real_Time;
@b<with> Ada.Task_Identification;
@b<package> Ada.Dispatching.EDF
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<subtype> Deadline @b<is> Ada.Real_Time.Time;
@b<subtype> Relative_Deadline @b<is> Ada.Real_Time.Time_Span;
Default_Deadline : @b<constant> Deadline :=
Ada.Real_Time.Time_Last;
Default_Relative_Deadline : @b<constant> Relative_Deadline :=
Ada.Real_Time.Time_Span_Last;
@b<procedure> Set_Deadline
(D : @b<in> Deadline;
T : @b<in> Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
@b<function> Get_Deadline
(T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task) @b<return> Deadline;
@b<procedure> Set_Relative_Deadline
(D : @b<in> Relative_Deadline;
T : @b<in> Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task);
@b<function> Get_Relative_Deadline
(T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
@b<return> Relative_Deadline;
@b<procedure> Delay_Until_And_Set_Deadline
(Delay_Until_Time : @b<in> Ada.Real_Time.Time;
Deadline_Offset : @b<in> Ada.Real_Time.Time_Span)
@b<with> Nonblocking =@> False;
@b<function> Get_Last_Release_Time
(T : Ada.Task_Identification.Task_Id :=
Ada.Task_Identification.Current_Task)
@b<return> Ada.Real_Time.Time;
@b<end> Ada.Dispatching.EDF;>
!corrigendum D.4(7/2)
!AI-0163-1
!AI-0183-1
@drepl
Two queuing policies, FIFO_Queuing and
Priority_Queuing, are language defined. If no Queuing_Policy pragma applies
to any of the program units comprising the partition, the queuing policy
for that partition is FIFO_Queuing. The rules for this policy are specified
in 9.5.3 and 9.7.1.
@dby
Three queuing policies, FIFO_Queuing, Ordered_FIFO_Queuing, and
Priority_Queuing, are language defined. If no Queuing_Policy pragma applies
to any of the program units comprising the partition, the queuing policy
for that partition is FIFO_Queuing. The rules for the FIFO_Queuing policy are
specified in 9.5.3 and 9.7.1.
The Ordered_FIFO_Queuing policy is defined as follows:
@xbullet<Calls are selected on a given entry queue in order of arrival.>
@xbullet<When more than one condition of an @fa<entry_barrier> of a protected
object becomes True, and more than one of the respective queues is nonempty,
the call that arrived first is selected.>
@xbullet<If the expiration time of two or more open @fa<delay_alternative>s
is the same and no other @fa<accept_alternative>s are open, the
@fa<sequence_of_statements> of the @fa<delay_alternative> that is first in
textual order in the @fa<selective_accept> is executed.>
@xbullet<When more than one alternative of a @fa<selective_accept> is open
and has queued calls, the alternative whose queue has the call that arrived
first is selected.>
!corrigendum D.5.1(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> System;
@b<with> Ada.Task_Identification; @ft<@i<-- See C.7.1>>
@b<package> Ada.Dynamic_Priorities @b<is>
@b<pragma> Preelaborate(Dynamic_Priorities);>
@dby
@xcode<@b<with> System;
@b<with> Ada.Task_Identification; @ft<@i<-- See C.7.1>>
@b<package> Ada.Dynamic_Priorities
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.7(2)
!AI-0290-1
!AI-0369-1
@dinsb
The following @i<restriction_>@fa<identifier>s are language-defined:
@dinss
A scalar @fa<expression> within a protected unit is said to be
@i<pure-barrier-eligible> if it is one of the following:
@xbullet<a static expression;>
@xbullet<a @fa<name> that statically names (see 4.9) a scalar subcomponent
of the immediately enclosing protected unit;>
@xbullet<a Count @fa<attribute_reference> whose @fa<prefix> statically
denotes an entry declaration of the immediately enclosing unit;>
@xbullet<a call to a predefined relational operator or boolean logical
operator (@b<and>, @b<or>, @b<xor>, @b<not>), where each operand is
pure-barrier-eligible;>
@xbullet<a membership test whose @i<tested_>@fa<simple_expression> is
pure-barrier-eligible, and whose @fa<membership_choice_list>
meets the requirements for a static membership test (see 4.9);>
@xbullet<a short-circuit control form both of whose operands are
pure-barrier-eligible;>
@xbullet<a @fa<conditional_expression> all of whose @fa<condition>s,
@i<selecting_>@fa<expression>s, and @i<dependent_>@fa<expression>s are
pure-barrier-eligible; or>
@xbullet<a pure-barrier-eligible @fa<expression> enclosed in parentheses.>
!corrigendum D.8(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Real_Time @b<is>>
@dby
@xcode<@b<package> Ada.Real_Time
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.10(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Synchronous_Task_Control @b<is>
@b<pragma> Preelaborate(Synchronous_Task_Control);>
@dby
@xcode<@b<package> Ada.Synchronous_Task_Control
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.10(5.2/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Real_Time;
@b<package> Ada.Synchronous_Task_Control.EDF @b<is>
@b<procedure> Suspend_Until_True_And_Set_Deadline
(S : @b<in out> Suspension_Object;
TS : @b<in> Ada.Real_Time.Time_Span);
@b<end> Ada.Synchronous_Task_Control.EDF;>
@dby
@xcode<@b<with> Ada.Real_Time;
@b<package> Ada.Synchronous_Task_Control.EDF
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<procedure> Suspend_Until_True_And_Set_Deadline
(S : @b<in out> Suspension_Object;
TS : @b<in> Ada.Real_Time.Time_Span)
@b<with> Nonblocking =@> False;
@b<end> Ada.Synchronous_Task_Control.EDF;>
!corrigendum D.10.1(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Synchronous_Barriers @b<is>
@b<pragma> Preelaborate(Synchronous_Barriers);>
@dby
@xcode<@b<package> Ada.Synchronous_Barriers
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.11(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Task_Identification;
@b<package> Ada.Asynchronous_Task_Control @b<is>
@b<pragma> Preelaborate(Asynchronous_Task_Control);
@b<procedure> Hold(T : @b<in> Ada.Task_Identification.Task_Id);
@b<procedure> Continue(T : @b<in> Ada.Task_Identification.Task_Id);
@b<function> Is_Held(T : Ada.Task_Identification.Task_Id)
@b<return> Boolean;
@b<end> Ada.Asynchronous_Task_Control;>
@dby
@xcode<@b<with> Ada.Task_Identification;
@b<package> Ada.Asynchronous_Task_Control
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<procedure> Hold(T : @b<in> Ada.Task_Identification.Task_Id);
@b<procedure> Continue(T : @b<in> Ada.Task_Identification.Task_Id);
@b<function> Is_Held(T : Ada.Task_Identification.Task_Id)
@b<return> Boolean;
@b<end> Ada.Asynchronous_Task_Control;>
!corrigendum D.14(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Task_Identification;
@b<with> Ada.Real_Time; @b<use> Ada.Real_Time;
@b<package> Ada.Execution_Time @b<is>>
@dby
@xcode<@b<with> Ada.Task_Identification;
@b<with> Ada.Real_Time; @b<use> Ada.Real_Time;
@b<package> Ada.Execution_Time
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.14.1(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> System;
@b<package> Ada.Execution_Time.Timers @b<is>>
@dby
@xcode<@b<with> System;
@b<package> Ada.Execution_Time.Timers
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.14.2(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> System;
@b<with> System.Multiprocessors;
@b<package> Ada.Execution_Time.Group_Budgets @b<is>>
@dby
@xcode<@b<with> System;
@b<with> System.Multiprocessors;
@b<package> Ada.Execution_Time.Group_Budgets
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.14.3(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Interrupts;
@b<package> Ada.Execution_Time.Interrupts @b<is>
@b<function> Clock (Interrupt : Ada.Interrupts.Interrupt_Id)
@b<return> CPU_Time;
@b<function> Supported (Interrupt : Ada.Interrupts.Interrupt_Id)
@b<return> Boolean;
@b<end> Ada.Execution_Time.Interrupts;>
@dby
@xcode<@b<with> Ada.Interrupts;
@b<package> Ada.Execution_Time.Interrupts
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>
@b<function> Clock (Interrupt : Ada.Interrupts.Interrupt_Id)
@b<return> CPU_Time;
@b<function> Supported (Interrupt : Ada.Interrupts.Interrupt_Id)
@b<return> Boolean;
@b<end> Ada.Execution_Time.Interrupts;>
!corrigendum D.15(3/2)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Real_Time.Timing_Events @b<is>>
@dby
@xcode<@b<package> Ada.Real_Time.Timing_Events
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.16(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> System.Multiprocessors @b<is>
@b<pragma> Preelaborate(Multiprocessors);>
@dby
@xcode<@b<package> System.Multiprocessors
@b<with> Preelaborate, Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum D.16(14/3)
!AI-0281-1
!AI-0321-1
@drepl
The CPU value determines the processor on which the task will
activate and execute; the task is said to be assigned to
that processor. If the CPU value is Not_A_Specific_CPU,
then the task is not assigned to a processor.
A task without a CPU aspect specified will activate and execute on the same
processor as its activating task if the activating task is assigned
a processor. If the CPU value is not in the range of
System.Multiprocessors.CPU_Range or is greater than Number_Of_CPUs
the task is defined to have failed, and it becomes a completed task (see
9.2).
@dby
For a task, the CPU value determines the processor on which the task will
activate and execute; the task is said to be assigned to
that processor. If the CPU value is Not_A_Specific_CPU,
then the task is not assigned to a processor.
A task without a CPU aspect specified will activate and execute on the same
processor as its activating task if the activating task is assigned
a processor. If the CPU value is not in the range of
System.Multiprocessors.CPU_Range or is greater than Number_Of_CPUs
the task is defined to have failed, and it becomes a completed task (see
9.2).
For a protected type, the CPU value determines the processor on which calling tasks
will execute; the protected object is said to be assigned to that processor. If
the CPU value is Not_A_Specific_CPU, then the protected object is not assigned to
a processor. A call to a protected object that is assigned to a processor from a
task that is not assigned a processor or is assigned a different processor
raises Program_Error.
@s8<@i<Implementation Advice>>
Starting a protected action on a protected object statically assigned to a
processor should be implemented without busy-waiting.
!corrigendum D.16.1(3/3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Real_Time;
@b<with> Ada.Task_Identification;
@b<package> System.Multiprocessors.Dispatching_Domains @b<is>>
@dby
@xcode<@b<with> Ada.Real_Time;
@b<with> Ada.Task_Identification;
@b<package> System.Multiprocessors.Dispatching_Domains
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum E.5(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<with> Ada.Streams; -- @ft<@i<see 13.13.1>>
@b<package> System.RPC @b<is>>
@dby
@xcode<@b<with> Ada.Streams; -- @ft<@i<see 13.13.1>>
@b<package> System.RPC
@b<with> Nonblocking =@> False, Global =@> @b<in out synchronized> @b<is>>
!corrigendum F.3.3(3)
!AI-0241-1
!AI-0302-1
@drepl
@xcode<@b<package> Ada.Text_IO.Editing @b<is>>
@dby
@xcode<@b<package> Ada.Text_IO.Editing
@b<with> Nonblocking, Global =@> @b<in out synchronized> @b<is>>
!corrigendum H.4(23)
!AI-0020-1
!AI-0079-3
!AI-0340-1
@dinsa
@xhang<@xterm<No_Reentrancy>During the execution of a subprogram by a task,
no other task invokes the same subprogram.>
@dinss
@xhang<@xterm<No_Unspecified_Globals>No library-level entity shall
have a Global aspect of Unspecified, either explicitly or by default.
No library-level entity shall have a Global'Class aspect of Unspecified,
explicitly or by default, if it is used as part of a dispatching call.>
@xhang<@xterm<No_Hidden_Indirect_Globals>When within a context where the
applicable Global aspect is neither Unspecified nor @b<in out all>, any
execution within such a context does neither of the following:>
@xinbull<Update a variable that is reachable via a sequence of zero or
more dereferences of access-to-object values from a formal
parameter of mode @b<in> (after any @b<overriding> @endash see H.7), or
from a global that is not within the applicable global variable set,
or has mode @b<in>;>
@xinbull<Read a variable that is updatable via a sequence of zero or
more dereferences of access-to-object values from a global that
is not within the applicable global variable set.>
@xindent<For the purposes of the above rules, if an applicable global
variable set includes a package name, and the collection of some
pool-specific access type (see 7.6.1) is implicitly declared in a
part of the declarative region of the package included within the
global variable set, then all objects allocated from that
collection are considered included within the global variable set.>
@xindent<The consequences of violating the No_Hidden_Indirect_Globals
restriction is implementation-defined. Any aspects or other means
for identifying such violations prior to or during execution are
implementation-defined.>
@s8<@i<Dynamic Semantics>>
The following @i<restriction_parameter_>@fa<identifier> is language defined:
@xhang<@xterm<Max_Image_Length>
Specifies the maximum length for the result of an Image, Wide_Image, or
Wide_Wide_Image attribute. Violation of this restriction results in the
raising of Program_Error at the point of the invocation of an image
attribute.>
!corrigendum H.4(23.8/2)
!AI-0020-1
!AI-0340-1
@dinsa
@xbullet<Max_Tasks =@> 0.>
@dinst
If a Max_Image_Length restriction applies to any compilation unit in
the partition, then for any subtype S, S'Image, S'Wide_Image, and
S'Wide_Wide_Image shall be implemented within that partition without
any dynamic allocation.
!corrigendum H.5(5/2)
!AI-0247-1
!AI-0267-1
@drepl
An implementation is required to detect a potentially blocking operation within
a protected operation, and to raise Program_Error (see 9.5.1).
@dby
An implementation is required to detect a potentially blocking operation that
occurs during the execution of a protected operation or a parallel construct
defined within a compilation unit to which the pragma applies, and to raise
Program_Error (see 9.5).
Questions? Ask the ACAA Technical Agent