CVS difference for ai12s/ai12-0120-1.txt

Differences between 1.2 and version 1.3
Log of other versions for file ai12s/ai12-0120-1.txt

--- ai12s/ai12-0120-1.txt	2014/06/23 23:30:52	1.2
+++ ai12s/ai12-0120-1.txt	2014/07/15 04:25:25	1.3
@@ -1,20 +1,24 @@
-!standard 5.5.2(6.1/4)                                14-06-23  AI05-0120-1/02
+!standard 5.5.2(6.1/4)                                14-07-14  AI05-0120-1/03
 !standard 5.5.2(10/3)
 !standard 5.5.2(13/3)
 !class binding interpretation 14-06-20
+!status Corrigendum 2015 14-07-14
+!status ARG Approved 7-0-0  14-06-29
 !status work item 14-06-20
 !status received 14-06-04
 !priority Low
 !difficulty Easy
 !qualifier Omission
-!subject "in out" parameters on a default iterator function
+!subject Legality and exceptions of generalized loop iteration
 
 !summary
 
 If the call to the default iterator function would be illegal, a container
-element iterator is illegal. If any of the calls to functions in a container
-element iterator propagates an exception, the container element iterator
-propagates the exception.
+element iterator is illegal. If the cursor type for a generalized iterator
+or container element iterator is limited, the iterator is illegal. If any of
+the calls to functions in a generalized iterator or container element
+iterator propagates an exception, the enclosing loop statement propagates
+the exception.
 
 !question
 
@@ -48,20 +52,19 @@
 
 Add after 5.5.2(6.1/4): [A legality rule added by AI12-0047-1]
 
-For a container element iterator, if the call of the default iterator
-function that creates the loop iterator (see below) would be illegal, then
-the container element iterator is illegal.
+A container element iterator is illegal if the call of the default iterator
+function that creates the loop iterator (see below) is illegal.
 
 AARM Ramification: This can happen if the parameter to the default iterator
-  function is *in out* and the iterable_name is a constant. We wrote the
-  wording to apply to any reason that the call would be illegal, as it's
+  function is *in out* and the iterable_name is a constant. The wording
+  applies to any reason that the call would be illegal, as it's
   possible that one of the default parameters would be illegal, or that
-  some accessibility check would fail. (We can't come up with an example
-  of an accessibility check failure, but that area is so complex that it's
-  easy to believe that there is a way for it to fail.)
+  some accessibility check would fail. [Editor's note: I can't come up with
+  an example of an accessibility check failure, but that area is so complex
+  that it's easy to believe that there is a way for it to fail.]
 
 A generalized iterator is illegal if the iteration cursor subtype of the
-iterable_name is a limited type at the point of the generalized iterator.
+iterator_name is a limited type at the point of the generalized iterator.
 A container element iterator is illegal if the default cursor subtype 
 of the type of the iterable_name is a limited type at the point of the
 container element iterator.
@@ -83,32 +86,16 @@
 
 Delete AARM 5.5.2(10.b/4) (it's covered by the above).
 
-Add after 5.5.2(10/3):
-
-Any exception raised during the execution of a generalized iterator as
-described above is propagated by the generalized iterator.
-
-AARM To Be Honest: We're not talking about exceptions raised and then
-  handled within the sequence_of_statements; this text is mainly concerned
-  about exceptions raised by the implementation of the generalized iterator.
-
-AARM Ramification: Note that this text covers exceptions raised by called
-  functions, as well as exceptions raised by the assignment to the loop
-  parameter.
-
 Add after 5.5.2(13/3):
 
-Any exception raised during the execution of a container element iterator as
-described above is propagated by the container element iterator.
+Any exception propagated by the execution of a generalized iterator or
+container element iterator is propagated by the immediately enclosing loop
+statement. 
+
+AARM Ramification: This text covers exceptions raised by called
+  functions that make up the execution of the iterator as well as exceptions
+  raised by the assignment to the loop parameter or cursor.
 
-AARM To Be Honest: We're not talking about exceptions raised and then
-  handled within the sequence_of_statements; this text is mainly concerned
-  about exceptions raised by the implementation of the ontainer element iterator.
-
-AARM Ramification: Note that this text covers exceptions raised by called
-  functions, as well as exceptions raised by the assignment to the loop
-  cursor.
-
 !discussion
 
 We want this to work just like a macro-expansion into the appropriate code,
@@ -118,12 +105,61 @@
 of the calls to those functions from being illegal, so we don't need any
 rules for them.
 
+We specify that an exception raised by one of the calls that are used to
+implement an iterator, or by an assignment used to implement an iterator,
+is propagated by the loop statement. This means that those exceptions
+cannot be handled inside of the loop; in particular, they cannot be
+handled by the sequence_of_statements.
+
+!corrigendum 5.5.2(6/3)
+
+@dinsa
+In a container element iterator whose @i<iterable_>@fa<name> has
+type @i<T>, if the @i<iterable_>@fa<name> denotes a
+constant or the Variable_Indexing aspect is not specified for @i<T>,
+then the Constant_Indexing aspect shall be specified for @i<T>.
+@dinss
+A container element iterator is illegal if the call of the default iterator
+function that creates the loop iterator (see below) is illegal.
+
+A generalized iterator is illegal if the iteration cursor subtype of the
+@i<iterator_>@fa<name> is a limited type at the point of the generalized iterator.
+A container element iterator is illegal if the default cursor subtype 
+of the type of the @i<iterable_>@fa<name> is a limited type at the point of the
+container element iterator.
+
+!corrigendum 5.5.2(13/3)
+
+@dinsa
+For a forward container element iterator, the operation First of the iterator
+type is called on the loop iterator, to produce the initial value for the loop
+cursor. If the result of calling Has_Element on the initial value is False, then
+the execution of the @fa<loop_statement> is complete. Otherwise, the
+@fa<sequence_of_statements> is executed with the loop parameter denoting an
+indexing (see 4.1.6) into the iterable container object for the loop, with the
+only parameter to the indexing being the current value of the loop cursor; then
+the Next operation of the iterator type is called with the loop iterator and the
+loop cursor to produce the next value to be assigned to the loop cursor. This
+repeats until the result of calling Has_Element on the loop cursor is False, or
+until the loop is left as a consequence of a transfer of control. For a reverse
+container element iterator, the operations Last and Previous are called rather
+than First and Next. If the loop parameter is a constant (see above), then the
+indexing uses the default constant indexing function for the type of the iterable
+container object for the loop; otherwise it uses the default variable indexing
+function.
+@dinst
+Any exception propagated by the execution of a generalized iterator or
+container element iterator is propagated by the immediately enclosing loop
+statement. 
+
 !ASIS
 
 No ASIS effect.
 
 !ACATS test
 
+ACATS B-Test(s) are needed for the Legality Rules. A low priority C-Test
+is needed to ensure that any exceptions are propagated properly.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent