Version 1.23 of ai12s/amd2xcon.txt

Unformatted version of ai12s/amd2xcon.txt version 1.23
Other versions for file 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.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.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.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 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.1(0)
!AI-0249-1
!AI-0295-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 nonoverridable, type-related operational aspects may be specified for any type @i<T>:
@xhang<@xterm<Integer_Literal> This aspect is specified by a @i<function_>@fa<name> that denotes a primitive function of @i<T> with one parameter of type String and a result type of @i<T>.>
@xhang<@xterm<Real_Literal> This aspect is specified by a @i<function_>@fa<name> that denotes a primitive function of @i<T> with one parameter of type String and a result type of @i<T>.>
@xhang<@xterm<String_Literal> This aspect is specified by a @i<function_>@fa<name> that denotes a primitive function of @i<T> with one parameter of type Wide_Wide_String and a result type of @i<T>.>
@xindent<A type with a specified String_Literal aspect is considered a @i<string type>.>
@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 (in the absence of the String_Literal aspect specification). 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<Dynamic Semantics>>
For the evaluation of an integer (or real) literal with expected type having an Integer_Literal (or Real_Literal) aspect specified, the value is the result of a call on the function specified by the aspect, with the parameter being a string with lower bound one whose value corresponds to the textual representation of the integer (or real) literal.
For the evaluation of a @fa<string_literal> with expected type having a String_Literal aspect specified, the value is the result of a call on the function specified by the aspect, with the parameter being the Wide_Wide_String with lower bound one that corresponds to the literal.
@s8<@i<Bounded (Run-Time) Errors>>
It is a bounded error if the evaluation of a literal with expected type having a corresponding _Literal aspect specified, propagates an exception. The possible effect is that an error is reported prior to run time, or Program_Error or the exception propagated by the evaluation is raised at the point of use of the value of the literal.
!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.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(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-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 with zero 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 iteration(s);>
!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 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.4(0)
!AI-0127-1
!AI-0212-1
@dinsc A (record or array) delta aggregate yields a composite value resulting from starting with a copy of another value of the same type and then subsequently assigning 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> and using that value 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 and tag (if any) of the anonymous object of a @fa<record_delta_aggregate> are those 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 (Link) @b<with delta> Value =@> 42);
--@ft<@i< see 3.10.1 for Cell and Link; 6.1 for Min_Cell>>>
@xcode<A1 : Vector := ((1.0, 2.0, 3.0) @b<with delta> Integer (Random * 3.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 =@> Apr); --@ft<@i< see 3.8>>>
The base expression may also be class-wide:
@xcode<@b<function> Translate (P : Point'Class; X, Y : Float) @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.5.10(0)
!AI-0242-1
!AI-0262-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_component_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>[, @i<combiner_>@fa<name>]>
For the case of an @fa<iterated_component_association> of a @fa<value_sequence> having a @fa<discrete_choice_list>, there shall be exactly one @fa<discrete_choice> in the @fa<discrete_choice_list>, which shall be a @i<discrete_>@fa<subtype_indication> or a @fa<range>.
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<A @i<combiner subprogram> is a reducer subprogram where both parameters are of subtype @i<Accum_Type>.>
@xbullet<The @i<reducer_>@fa<name> of a @fa<reduction_specification> denotes a reducer subprogram.>
@xbullet<The @i<combiner_>@fa<name>, if any, of a @fa<reduction_specification> denotes a combiner 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 a @fa<value_sequence> is that of subtype @i<Value_Type>.>
@xbullet<For an @fa<iterated_component_association> of a @fa<value_sequence> that has a @fa<discrete_choice_list> comprising a single @fa<range>, the @fa<range> shall resolve to some discrete type; which discrete type shall be determined without using any context other than the bounds of the range itself (plus the preference for @i<root_integer> - see 8.6). If the range resolves to @i<root_integer>; the type of the index parameter of the @fa<iterated_component_association> (the @i<index type> of the @fa<value_sequence>) is Integer; otherwise the index type is the resolved type of the @i<discrete_>@fa<subtype_indication> or @fa<range> of the @fa<discrete_choice_list>. For an @fa<iterated_component_association> of a @fa<value_sequence> that has an @fa<iterator_specification>, the index type of the @fa<value_sequence> is Integer and the type of the loop parameter of the @fa<iterator_specification> is as defined in 5.5.2.>
@s8<@i<Legality Rules>>
The @i<combiner_>@fa<name> of a @fa<reduction_specification> shall be specified if the subtypes of the parameters of the subprogram denoted by the @i<reducer_>@fa<name> of the @fa<reduction_specification> do not statically match each other and the @fa<reduction_attribute_reference> has a @fa<value_sequence> with the reserved word @b<parallel>.
If the @fa<identifier> of a @fa<reduction_attribute_designator> is Parallel_Reduce then the @i<combiner_>@fa<name> of the @fa<reduction_specification> shall be specified if the subtypes of all the parameters of the subprogram denoted by the @i<reducer_>@fa<name> of the @fa<reduction_specification> do not statically match.
@s8<@i<Static Semantics>>
The nominal subtype of the index parameter of a @fa<value_sequence> is that of the @fa<discrete_choice>. The nominal subtype of the loop parameter of a @fa<value_sequence> is as defined for an @fa<iterator_specification> (see 5.5.2).
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>.
For a @fa<reduction_attribute_reference> that has a @fa<value_sequence> with the reserved word @b<parallel>, if the @i<combiner_>@fa<name> is not specified, then the subprogram denoted by the @i<reducer_>@fa<name> also implicitly denotes the combiner subprogram.
For a @fa<reduction_attribute_reference> where the @fa<identifier> of the @fa<reduction_attribute_designator> is Parallel_Reduce, if the @i<combiner_>@fa<name> is not specified, then the subprogram denoted by the @i<reducer_>@fa<name> also implicitly denotes the combiner subprogram.
@s8<@i<Dynamic Semantics>>
For the evaluation of a @fa<value_sequence>:
@xbullet<if the @fa<iterated_component_association> has an @fa<iterator_specification>, an iteration is performed for that @fa<iterator_specification> (as described in 5.5.2), and for each value produced by the iterator, 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;>
@xbullet<otherwise, the @fa<discrete_choice_list> of the @fa<iterated_component_association> is evaluated, and for each value, in increasing order, of the discrete subtype or range defined by the @fa<discrete_choice_list>, the associated @fa<expression> is evaluated with the index 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[, Combiner])> 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, the @i<initial_value_>@fa<expression> Initial_Value, and the @i<combiner_>@fa<name> Combiner, if any), 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. Combiner, if specified, is ignored for such a (sequential) reduction expression.>
@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. If there is a separate Combiner subprogram specified, then the accumulator for each subsequence is initialized to the initial value, and Reducer is called in sequence order with each value of the subsequence as the second (Value) parameter, and with this local accumulator as the first (Accumulator) parameter, saving the result back into this local accumulator. If there is no separate combiner specified, then 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). In either case, 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, Combiner (or Reducer, if Combiner is not specified) 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 or Combiner, 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 denotes an iterable container object (see 5.5.1), the following attributes are defined:
@xhang<@xterm<X'Reduce(Reducer, Initial_Value[, Combiner])>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[, Combiner])>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>>
If a parallel reduction expression has a combiner subprogram specified, then it is a bounded error if the initial value is not the (left) identity of the combiner subprogram. That is, the result of calling the combiner subprogram with the Accumulator being the initial value and the Value being any arbitrary value of subtype @i<Accum_Type> should produce a result equal to the Value parameter. The possible consequences are Program_Error, or a result that does not match the equivalent sequential reduction expression due to multiple uses of the non-identity initial value in the overall reduction.
@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 Sin of X using Taylor expansion:
@xcode<@b<function> Sin (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(Fact(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 / Number_Of_Steps *
[@b<for> I @b<in> 1 .. Number_Of_Steps =@>
(4.0 / (1.0 + ((Real (I) - 0.5) * (1.0 / 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)>
!corrigendum 4.10(0)
!AI-0020-1
!AI-0315-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<Arg>> : @b<in> T;
@ft<@i<Stream>> : @b<not null access> Ada.Streams.Root_Stream_Type'Class);>
@xindent<The default implementation of S'Put_Image writes (using Wide_Wide_String'Write) 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
(Arg : Scalar_Type; Stream : @b<access> Ada.Streams.Root_Stream_Type'Class) @b<is>
@b<begin>
Wide_Wide_String'Write (@i<<described below@>>, Stream);
@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 write a sequence of Wide_Wide_Character values out to a stream) and then returns the result of reading the contents of that stream via Wide_Wide_String'Read. The lower bound of the result is 1.>
@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<The function returns the result of a call on S'Wide_Wide_Image with a parameter of @i<Arg> as a Wide_String. The lower bound of the result is one. The result has the same sequence of graphic characters as that returned by S'Wide_Wide_Image if all the graphic characters are defined in Wide_Character; otherwise, the sequence of characters is implementation defined (but no shorter than that of S'Wide_Wide_Image for the same value of @i<Arg>).>
@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<The function returns the result of a call on S'Wide_Wide_Image with a parameter of @i<Arg> as a String. The lower bound of the result is one. The result has the same sequence of graphic characters as that returned by S'Wide_Wide_Image if all the graphic characters are defined in Character; otherwise, the sequence of characters is implementation defined (but no shorter than that of S'Wide_Wide_Image for the same value of @i<Arg>).>
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, carriage returns, and line feeds (Wide_Wide_Characters with positions 32, 10, and 13), may be inserted to improve readability of the generated image.>
!corrigendum 5.5(3/3)
!AI-0119-1
!AI-0189-1
!AI-0251-1
!AI-0266-1
@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<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(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-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 elaboration 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 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.2(2/3)
!AI-0156-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<defining_identifier>@ [:@ @fa<loop_parameter_subtype_indication>]@ @b<of> [@b<reverse>]@ @i<iterable_>@fa<name>>
@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(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-0292-1
!AI-0294-1
!AI-0308-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>>
@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> 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>). This rule is an overloading rule (see 8.6).
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 following aspect may be specified for a subprogram or entry S that has at least 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 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 subprogram or entry is False.>
@xindent<Specifying the Allows_Exit aspect True for a subprogram asserts that the subprogram is prepared to be completed by arbitrary transfers of control from the subprogram represented by the access-to-subprogram value, including propagation of exceptions. A subprogram for which Allows_Exit is True should use finalization for any necessary cleanup, and in particular should not use exception handling to implement cleanup.>
@s8<@i<Legality Rules>>
If a subprogram or entry overrides an inherited dispatching subprogram that has a True Allows_Exit aspect, only a confirming specification of True is permitted for the aspect on the overriding declaration.
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 @i<C> associated with the @fa<procedural_iterator> has an Allows_Exit aspect specified True.
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<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.Iterator (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(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
@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.
!corrigendum 6.1.2(0)
!AI-0079-1
!AI-0310-1
@dinsc
For a program unit, formal package, formal subprogram, formal object of an anonymous access-to-subprogram type, and for a named access-to-subprogram type or composite type (including a formal type), 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 @ @ @ @ @fa<primitive_global_aspect_definition>@hr @ @ |@ @i<global_>@fa<attribute_reference>@hr @ @ |@ @fa<global_aspect_definition> & @i<global_>@fa<attribute_reference>>
@xindent<@fa<primitive_global_aspect_definition>@fa<@ ::=@ >@hr @ @ @ @ @b<null>@hr @ @ |@ @fa<global_mode> @fa<global_name>@hr @ @ |@ @fa<global_mode> @fa<global_designator>@hr @ @ |@ (@fa<global_mode> @fa<global_set>{, @fa<global_mode> @fa<global_set>})>
@xindent<@fa<global_mode>@fa<@ ::=@ >[ @fa<global_mode_qualifier> ] @fa<basic_global_mode>>
@xindent<@fa<global_mode_qualifier>@fa<@ ::=@ >@hr @ @ @ @ @b<synchronized>@hr @ @ |@ @i<implementation-defined_>@fa<identifier>>
@xindent<@fa<basic_global_mode>@fa<@ ::=@ >@b<in> | @b<in out> | @b<out>>
@xindent<@fa<global_set>@fa<@ ::=@ >@hr @ @ @ @ @fa<global_name> {, @fa<global_name>}@hr @ @ |@ @fa<global_designator>>
@xindent<@fa<global_designator>@fa<@ ::=@ >@b<all> | @b<null>>
@xindent<@fa<global_name>@fa<@ ::=@ >@hr @ @ @ @ @i<object_>@fa<name>@hr @ @ |@ [@b<private of>] @i<package_>@fa<name>@hr @ @ |@ @i<access_>@fa<subtype_mark>@hr @ @ |@ @b<access> @fa<subtype_mark>>
@xindent<A @i<global_>@fa<attribute_reference> is an @fa<attribute_reference> whose @fa<attribute_designator> is Global.>
@xindent<The Global aspect identifies the set of variables (which, for the purposes of this clause includes all task objects) global to a callable entity that are potentially read or updated as part of the execution of a call on the entity. If not specified, the aspect defaults to the Global aspect for the nearest enclosing program unit. If not specified for a library unit, the aspect defaults to @fc<Global =@> @b<null>> for a nongeneric library unit that is declared Pure, and to @fc<Global =@> @b<in out all>> otherwise.>
For a dispatching subprogram or a tagged type, 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 nearest enclosing program unit.>
@s8<@i<Name Resolution Rules>>
A @fa<global_name> that does not have the reserved word @b<access> shall resolve to statically denote an object, a package (including a limited view of a package), or an access-to-variable subtype. The @fa<subtype_mark> of a @fa<global_name> that has the reserved word @b<access> shall resolve to denote a subtype (possibly an incomplete type).
@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 some operation. The Global'Class aspect associated with a tagged type @i<T> (or one of its dispatching operations) represents a restriction on the Global aspect on any descendant of type @i<T> (or its corresponding operation).
The Global aspect for a callable entity defines the global variables that might be referenced as part of a call on the entity. The Global aspect for a composite type identifies the global variables that might be referenced during default initialization, adjustment as part of assignment, or finalization of an object of the type. The Global aspect for an access-to-subprogram object (or type) identifies the global variables that might be referenced when calling via the object (or any object of that type). The Global aspect for any other elementary type is null.
The following is defined in terms of operations; the rules apply to all of the above kinds of entities.
The sets of global variables associated with a Global aspect can be defined explicitly with a @fa<primitive_global_aspect_definition> or can be defined by combining with the sets specified for other entities by referring to their Global attribute.
The global variables associated with any 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. The @fa<global_mode_qualifier> @b<synchronized> reduces the set to those objects that are of one of the following sort of types:
@xbullet<a protected, task, or synchronized tagged type;> @xbullet<an atomic type;> @xbullet<a descendant of the language-defined types Suspension_Object or Synchronous_Barrier;> @xbullet<a record type all of whose components are @i<sychronized> in this sense;> @xbullet<an array type whose component type is @i<sychronized> in this sense.>
An implementation-defined @fa<global_mode_qualifier> may be specified, which reduces the set according to an implementation-defined rule.
The overall set of objects associated with each @fa<global_mode> includes all objects identified for the mode in the @fa<primitive_global_aspect_definition> (subject to the @fa<global_mode_qualifier>), if any, plus all objects associated with the given mode for the entities identified by the @fa<prefix>es of the @i<global_>@fa<attribute_reference>s, if any.
A @fa<global_set> identifies a @i<global variable set> as follows:
@xbullet<@b<null> identifies the empty set of global variables;> @xbullet<@b<all> identifies the set of all global variables;> @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 nonpreelaborable constant);>
@xinbull<@i<package_>@fa<name> identifies the set of all variables declared within the declarative region of the package having the same accessibility level as the package, but not including those within the declarative region of a public child of the package; if the reserved words @b<private of> precede the @i<package_>@fa<name>, the set is reduced to those variables declared in the private part or body of the package or within a private descendant of the package;>
@xinbull<@i<access_>@fa<subtype_mark> identifies the set of (aliased) variables that can be designated by values of the given access-to-variable type;>
@xinbull<@b<access> @fa<subtype_mark> identifies the set of (aliased) objects that can be designated by values of an access-to-variable type with a designated subtype statically matching the given @fa<subtype_mark>.>
@s8<@i<Legality Rules>>
Within a @fa<primitive_global_aspect_definition>, a given @fa<global_mode> shall be specified at most once without a @fa<global_mode_qualifier>, and at most once with any given @fa<global_mode_qualifier>. Similarly, within a @fa<primitive_global_aspect_definition>, a given entity shall be named at most once by a @fa<global_name>.
If an entity has a Global aspect other than @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> modes, 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. This includes any calls occurring during the execution of the operation, presuming those calls read and update all global variables permitted by their Global aspect (or Global'Class aspect, if a dispatching call).
If a variable global to the entity is read that is within the global variable set associated with the @b<out> @fa<global_mode>, it shall be updated somewhere within the callable entity (or an entity it calls).
If an implementation-defined @fa<global_mode_qualifier> applies to a given set of variables, an implementation-defined rule determines what sort of references to them are permitted.
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>. A corresponding rule applies to the Global aspect of a tagged type @i<T> relative to the Global'Class aspect of any ancestor of @i<T>.
For a @fa<prefix> S that statically denotes a subprogram (including a formal subprogram), formal object of an anonymous access-to-subprogram type, or a type (including a formal type), the following attribute is defined:
@xhang<@xterm<S'Global>Identifies the global variable set for each of the three @fa<global_mode>s, for the given subprogram, object, or type; a reference to this attribute may only appear within a @fa<global_aspect_definition>.>
@s8<@i<Implementation Permissions>>
For a call on a subprogram that has a Global aspect that indicates that there are no references to global variables, the implementation may omit the call:
@xbullet<if the results are not needed after the call; or>
@xbullet<simply reuse the results produced by an earlier call on the same
subprogram, provided that none of the parameters nor any object accessible via access values from the parameters have any part that is of a type whose full type is an immutably limited type, and the addresses and values of all by-reference actual parameters, the values of all by-copy-in actual parameters, and the values of all objects accessible via access values from the parameters, are the same as they were at the earlier call.>
This permission applies even if the subprogram produces other side effects when called.
!corrigendum 7.3.2(8/3)
!AI-0075-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 non-discriminant 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).>
If one or more invariant expressions apply to a nonabstract type @i<T>, then a subprogram or entry is said to be @i<type-invariant preserving> for @i<T> if
@xbullet<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:>
@xinbull<@i<T> is a private type or a private extension and the subprogram or entry is visible outside the immediate scope of type @i<T> or overrides an inherited operation that is visible outside the immediate scope of @i<T>; or>
@xinbull<@i<T> is a record extension, and the subprogram or entry 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>.>
@xbullet<and at least one of the following applies to the callable entity:>
@xinbull<has a result with a part of type @i<T>;> @xinbull<has one or more @b<out> or @b<in out> parameters with a part of type @i<T>;> @xinbull<has an access-to-object parameter or result whose designated type has a part of type @i<T>; or> @xinbull<is a procedure or entry that has an @b<in> parameter with a part of type @i<T>.>
@xindent<Each such part of type @i<T> is said to be @i<subject to an invariant check> for @i<T>.>
!corrigendum 7.3.2(20/3)
!AI-0075-1
!AI-0193-1
@ddel The check is performed on each such part of type @i<T>.
!corrigendum 7.3.3(0)
!AI-0265
!AI-0272
@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 default 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.
!corrigendum 7.3.4(0)
!AI-0187-1
!AI-0272-1
!AI-0285-1
@dinsc
It is usual that some of the characteristics of a data type are unchanged by most of the primitive operations on 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> 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 for @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, where @i<F> is each stable property function 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, where @i<F> is each class-wide stable property function 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
@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 not permitted unless it is an @fa<aggregate>, a @fa<function_call>, a @fa<raise_expression>, a parenthesized @fa<expression> or @fa<qualified_expression> whose operand is permitted by this rule, a @fa<conditional_expression> all of whose @i<dependent_>@fa<expression>s are permitted by this rule, or a @fa<declare_expression> whose @i<body_>@fa<expression> is permitted by this rule:
!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.5(17/3)
!AI-0064-2
!AI-0247-1
!AI-0267-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 type (including a formal type), 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 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 a full type declaration that has a partial view, the aspect is the same as that of the partial view.>
@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 type, formal package, or formal subprogram, the Nonblocking aspect is that of the actual type, 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):
@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):
@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):
@xhang<@xterm<S'Nonblocking> Denotes whether predefined operators (and in the case of access-to-subprogram subtypes) a subprogram designated by a value of type 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.>
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.
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 a derived type only if it fully conforms to the nonblocking expression of the ancestor type 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>.
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.10.1(0)
!AI-0267-1
!AI-0294-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<);>>
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>>
The @i<policy_>@fa<identifier> shall be one of Unchecked, Known_Conflict_Checks, Parallel_Conflict_Checks, All_Conflict_Checks, or an implementation-defined conflict check policy.
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 Parallel_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<Unchecked> This policy imposes no restrictions.>
@xhang<@xterm<Known_Conflict_Checks> If this policy applies to two concurrent actions occuring within the same compilation unit, they are disallowed if they are known to denote the same object (see 6.4.1) with uses that potentially conflict. For the purposes of this check, any parallel loop may be presumed to involve multiple concurrent iterations, and any named task type may be presumed to have multiple instances.>
@xhang<@xterm<Parallel_Conflict_Checks> This policy includes the restrictions imposed by the Known_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_Conflict_Checks> This policy includes the restrictions imposed by the Parallel_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.>
@s8<@i<Implementation Permissions>>
When the applicable conflict check policy is Known_Conflict_Checks, the implementation may disallow two concurrent actions if the implementation can prove they will at run-time denote the same object with uses that potentially conflict.
!corrigendum 11.4.2(23.1/3)
!AI-0112-1
!AI-0179-1
!AI-0265-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 check corresponds to situations in which the exception Assertion_Error is raised upon failure of a language-defined check.>
@xhang<@xterm<Containers_Assertion_Check> Check the precondition of a routine declared in a descendant unit of Containers or in an instance of a generic unit that is declared in, or is, a descendant unit of Containers.>
!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-0079-1
!AI-0187-1
!AI-0285-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)
!AI-0206-1
!AI-0256-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, Max_Entry_Queue_Length, and No_Controlled_Parts aspects are nonoverridable.
!corrigendum 13.14(3/4)
!AI-0079-1
!AI-0155-1
!AI-0168-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.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.
If an instance of an Ada.Containers generic package is nonblocking, then the specific type of the object returned from a function that returns an object of an iterator interface, as well as the primitive operations of that specific type, shall be nonblocking.
!corrigendum A.18.2(8/3)
!AI-0111-1
!AI-0112-1
!AI-0212-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_Vector,
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.3(6/3)
!AI-0111-1
!AI-0112-1
!AI-0212-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_List,
Add_Unnamed =@> Append),
Stable_Properties =@> (Length, Capacity,
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.5(3/2)
!AI-0111-1
!AI-0112-1
!AI-0212-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_Map,
Add_Named =@> Insert),
Stable_Properties =@> (Length, Capacity,
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(4/3)
!AI-0111-1
!AI-0112-1
!AI-0212-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_Map,
Add_Named =@> Insert),
Stable_Properties =@> (Length, Capacity,
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.8(3/3)
!AI-0111-1
!AI-0112-1
!AI-0212-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_Set,
Add_Unnamed =@> Include),
Stable_Properties =@> (Length, Capacity,
Tampering_With_Cursors_Prohibited, Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Set) = 0 @b<and then> (@b<not> Tampering_With_Cursors_Prohibited (Set)) @b<and then> (@b<not> Tampering_With_Elements_Prohibited (Set));
@b<pragma> Preelaborable_Initialization(Set);>
!corrigendum A.18.9(4/3)
!AI-0111-1
!AI-0112-1
!AI-0212-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_Set,
Add_Unnamed =@> Include),
Stable_Properties =@> (Length, Capacity,
Tampering_With_Cursors_Prohibited, Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Set) = 0 @b<and then> (@b<not> Tampering_With_Cursors_Prohibited (Set)) @b<and then> (@b<not> Tampering_With_Elements_Prohibited (Set));
@b<pragma> Preelaborable_Initialization(Set);>
!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 =@> (Length, Capacity,
Tampering_With_Cursors_Prohibited, Tampering_With_Elements_Prohibited),
Default_Initial_Condition =@>
Length (Tree) = 0 @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 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 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.6(9/2)
!AI-0230-1
!AI-0241-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 @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 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