--- ai12s/ai12-0061-1.txt 2013/02/01 03:22:18 1.1 +++ ai12s/ai12-0061-1.txt 2013/11/13 01:47:00 1.2 @@ -1,4 +1,4 @@ -!standard 4.3.3(5/2) 13-01-31 AI12-0061-1/01 +!standard 4.3.3(5/2) 13-11-12 AI12-0061-1/02 !standard 4.3.3(23) !standard 3.1(6/3) !standard 3.3.1(23/3) @@ -38,62 +38,86 @@ !wording -Change 4.3.3(5/2) to: +Append to the end of the long semicolon-separated list of 3.1(6/3): -array_component_association ::= - discrete_choice_list => expression - | discrete_choice_list => <> - | parameterized_array_component_association + ; a parameterized_array_component_association. -Add after 4.3.3(5/2): +Add after 3.3(6) (as a bulleted list item): + - The index parameter of a parameterized_array_component_association. -parameterized_array_component_association ::= - for defining_identifier in discrete_choice_list => expression +Add after 3.3(18.1/3) (as a bulleted list item): + - The index parameter of a parameterized_array_component_association. -A parameterized_array_component_association declares an index -parameter, which is an object whose type is the corresponding index -type. If the discrete_choice_list is a single nonstatic -choice_expression or range, the constraint of the object's subtype is -the single value given by the choice_expression, or it is defined by -the range; otherwise, the bounds of the subtype's constraint are the -smallest and largest values covered by the discrete_choice_list. +Add ", parameterized_array_component_association" +in the comment-separated list of 3.3.1(23/3), immediately after ", +iterator_specification". -Change 4.3.3(23) to: + Change 4.3.3(5/2) to: + array_component_association ::= + discrete_choice_list => expression + | discrete_choice_list => <> + | parameterized_array_component_association -2. The array component expressions of the aggregate are evaluated in an -arbitrary order and their values are converted to the component -subtype of the array type; an array component expression is evaluated -once for each associated component. For a -parameterized_array_component_association, before an array component -expression is evaluated for an associated component, the index of that -component is assigned to the index parameter. + parameterized_array_component_association ::= + for defining_identifier in discrete_choice_list => expression -Add to the end of 3.1(6/3): +Add after 4.3.3(6) (at the end of the syntax section): -In addition, a parameterized_array_component_association is a -declaration of its defining_identifier. + The defining_identifier of a parameterized_array_component_association + declares an index_parameter, an object of the corresponding index + type. -Add after in 8.1(4.1/3): +Append after 4.3.3(20) (at the end of the static semantics section) -* a parameterized_array_component_association; + The subtype of an index_parameter is defined as follows: + - If every discrete_choice in the corresponding discrete_choice_list + either is a static expressions or is a subtype indication or range + that defines a static non-null range, then the lowest and + highest of the values covered by the discrete_choice_list + are the bounds of the subtype of the index parameter. + The subtype is constrained and static in this case. -Change the last sentence of 3.3.1(23/3) to: + - Otherwise the subtype is the corresponding index subtype. -An object declared by a loop_parameter_specification, -iterator_specification, parameter_specification, -entry_index_specification, choice_parameter_specification, -parameterized_array_component_association, -extended_return_statement, or a formal_object_declaration of mode in -out is not considered a stand-alone object. + The subtype of an index_parameter is also its nominal subtype. -** We also need conformance wording similar to that for quantified -expressions in AI12-0050-1. The editor did not add such wording because -AI12-0050-1 does not yet have a wording proposal. +TBD: define a static predicate for the subtype in the static case? This could +be useful with case expressions. -** The proposer suggests a note to point out this is not a for loop; the -order of evaluation of the array component expressions is unspecified. -The editor did not try to create such a note. +Add after 4.3.3(31) (at the end of the dynamic semantics section) +[Editor's note: I think this is the wrong place, as it is after checks and bounds text; +I think it belongs near 4.3.3(23).] + During an evaluation of the expression a parameterized + array_component_association, the value of the corresponding + index parameter is that of the corresponding index of the + corresponding array component. + +AARM Note: + Taken together with the preceding rule that "The array component + expressions of the aggregate are evaluated in an arbitrary order", + this implies that an index parameter can take on its values in an + arbitrary order. This is different than, for example, + a loop_parameter. + +Add after 4.3.3(32/3): [Editor's note: I moved this, Steve had it in the wrong +place.] + + Note: + An index_parameter is a constant object (see 3.3). + +[The note is intended to follow the example of 5.5(10).] + +In 5.5(6), replace "whose subtype" with "whose subtype (and nominal subtype)". +[Because the nominal subtype for a loop_parameter was never defined.] + +Add after 8.1(4) (as a bulleted list item): + - A parameterized_array_component_association; + +Add to the list of 13.1.1(4.b/3): (after iterator specification) + parameterizied_array_comonent_association -- NO + + !discussion We don't need to change 4.3.3(17), since the wording for applies to @@ -111,6 +135,17 @@ either the syntax is a regular for loop, or it can be expanded at compile time (as in the above example). So the extra implementation burden of allowing a list should be minimal. + +Note that the wording for AI12-0050 handles conformance for this new construct +with no need for any further wording changes in this area. For example, we +get the conformance we want for + + subtype S is Integer range 1 .. 10; + type Vec is array (S) of S; + + procedure P (X : Vec := (for Idx in S => Idx)); + procedure P (X : Vec := (for Idx in S => Idx)) is + begin null; end; !example

Questions? Ask the ACAA Technical Agent