CVS difference for arm/source/05.mss

Differences between 1.54 and version 1.55
Log of other versions for file arm/source/05.mss

--- arm/source/05.mss	2011/12/23 21:32:46	1.54
+++ arm/source/05.mss	2012/02/18 02:17:37	1.55
@@ -1,10 +1,10 @@
 @Part(05, Root="ada.mss")
 
-@Comment{$Date: 2011/12/23 21:32:46 $}
+@Comment{$Date: 2012/02/18 02:17:37 $}
 @LabeledSection{Statements}
 
 @Comment{$Source: e:\\cvsroot/ARM/Source/05.mss,v $}
-@Comment{$Revision: 1.54 $}
+@Comment{$Revision: 1.55 $}
 
 @begin{Intro}
 @Redundant[A @nt{statement} defines an action to be performed upon
@@ -1087,6 +1087,26 @@
 
 @end{Ramification}
 
+@begin{Reason}
+  @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0262-1]}
+  @ChgAdded{Version=[3],Type=[Leading],Text=[If there is a predicate, the loop
+  still visits the values in the order of the underlying base type; the order of
+  the values in the predicate is irrelevant. This is the case so that the
+  following loops have the same sequence of calls and parameters on procedure
+  Call for any subtype S:]}
+@begin{Example}
+@ChgAdded{Version=[3],Text=[@key[for] I @key[in] S @key[loop]
+   Call (I);
+@key[end loop];]}
+
+@ChgAdded{Version=[3],Text=[@key[for] I @key[in] S'Base @key[loop]
+   @key[if] I @key[in] S @key[then]
+      Call (I);
+   @key[end if];
+@key[end loop];]}
+@end{Example}
+@end{Reason}
+
 @ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0262-1]}
 @ChgAdded{Version=[3],Text=[@Redundant[For details about the execution of a
 @nt{loop_statement} with the @nt{iteration_scheme} being @key[for]
@@ -1227,9 +1247,9 @@
 instance of Ada.Iterator_Interfaces is the @i<iteration cursor subtype> for the
 iterator type.@Defn{iteration cursor subtype}]}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Type=[Leading],Text=[The following type-related
-operational aspects may be specified for an indexable type @i<T> (see
+operational aspects may be specified for an indexable container type @i<T> (see
 @RefSecNum{User-Defined Indexing}):]}
 
 @begin{Description}
@@ -1264,22 +1284,22 @@
 @ChgAdded{Version=[3],Text=[These aspects are inherited by descendants of
 type @i<T> (including @i<T>'Class).]}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
-@ChgAdded{Version=[3],Text=[An @i<iterable type> is an indexable type
-with specified Default_Iterator and Iterator_Element aspects.@Defn{iterable type}
-A @i<reversible iterable type> is an iterable type with the default iterator type
-being a reversible iterator type.@Defn{reversible iterable type}
-An @i<iterable object> is an object of an iterable type.@Defn{iterable object}
-A @i<reversible iterable object> is an object of a reversible iterable
-type.@Defn{reversible iterable object}]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
+@ChgAdded{Version=[3],Text=[An @i<iterable container type> is an indexable container type
+with specified Default_Iterator and Iterator_Element aspects.@Defn{iterable container type}
+A @i<reversible iterable container type> is an iterable container type with the default iterator type
+being a reversible iterator type.@Defn{reversible iterable container type}
+An @i<iterable container object> is an object of an iterable container type.@Defn{iterable container object}
+A @i<reversible iterable container object> is an object of a reversible iterable container
+type.@Defn{reversible iterable container object}]}
 
 @end{StaticSem}
 
 @begin{Legality}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Type=[Leading],Text=[The Constant_Indexing aspect (if any)
-of an iterable type @i<T> shall denote exactly one function with the following
+of an iterable container type @i<T> shall denote exactly one function with the following
 properties:]}
 
 @begin{Itemize}
@@ -1314,9 +1334,9 @@
   key instead of a cursor; this is allowed.]}
 @end{Ramification}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Type=[Leading],Text=[The Variable_Indexing aspect (if any)
-of an iterable type @i<T> shall denote exactly one function with the following
+of an iterable container type @i<T> shall denote exactly one function with the following
 properties:]}
 
 @begin{Itemize}
@@ -1367,7 +1387,7 @@
 @end{Syntax}
 
 @begin{Resolution}
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Text=[The first form of @nt{iterator_specification} is
 called a @i<generalized iterator>;@Defn{generalized iterator}@Defn2{Term=[iterator],Sec=[generalized]}
 the
@@ -1379,11 +1399,15 @@
 type.@PDefn2{Term=[expected type],Sec=[@SynI<array_>@nt{name} in an iterator]}
 The third form of @nt{iterator_specification} is called a
 @i<container element iterator>;@Defn{container element iterator}@Defn2{Term=[iterator],Sec=[container element]}
-the expected type for the @SynI<iterable_>@nt{name} is any iterable
+the expected type for the @SynI<iterable_>@nt{name} is any iterable container
 type.@PDefn2{Term=[expected type],Sec=[@SynI<iterable_>@nt{name}]}]}
 @end{Resolution}
 
 @begin{Legality}
+@ChgToGlossary{Version=[3],Kind=[Added],Term=<Iterator>,
+Text=<@ChgAdded{Version=[3],Text=[An iterator may be used to loop over the
+elements of an array or container. Generalized iterators may be user defined,
+and may perform arbitrary computations.]}>}
 
 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
 @ChgAdded{Version=[3],Text=[If the reserved word @key[reverse] appears,
@@ -1411,11 +1435,11 @@
 
 @begin{StaticSem}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0269-1]}
 @ChgAdded{Version=[3],Text=[An @nt{iterator_specification} declares a
 @i<loop parameter>.@Defn{loop parameter}
 In a generalized iterator, the nominal subtype of the loop parameter is
-the iterator cursor subtype. In an array component iterator or a
+the iteration cursor subtype. In an array component iterator or a
 container element iterator, if a @nt{subtype_indication} is present, it
 determines the nominal subtype of the loop parameter. In an array
 component iterator, if a @nt{subtype_indication} is not present, the
@@ -1483,23 +1507,23 @@
 array for the loop, or until the loop is left as a consequence of a
 transfer of control.]}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Text=[For a container element iterator, the @SynI<iterable_>@nt{name} is evaluated
-and the iterable object denoted by the name becomes the @i<iterable
-object for the loop>.@Defn{iterable object for a loop}
+and the iterable container object denoted by the name becomes the @i<iterable
+container object for the loop>.@Defn{iterable container object for a loop}
 The default iterator function for the type of
-the iterable object for the loop is called on the iterable object
+the iterable container object for the loop is called on the iterable container object
 and the result is the @i<loop iterator>.@Defn2{Term=[loop iterator],Sec=[container element iterator]}
 An object of the default cursor subtype is created (the @i<loop cursor>).@Defn{loop cursor}]}
 
-@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2]}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0139-2],ARef=[AI05-0292-1]}
 @ChgAdded{Version=[3],Text=[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 @nt{loop_statement} is
 complete. Otherwise, the @nt{sequence_of_statements} is executed with the loop
 parameter denoting an indexing (see @RefSecNum{User-Defined Indexing}) into the
-iterable object for the loop, with the only parameter to the indexing being 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
@@ -1507,12 +1531,20 @@
 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 object for the loop;
-otherwise it uses the default variable indexing function.]}
+constant indexing function for the type of the iterable container object for the
+loop; otherwise it uses the default variable indexing function.]}
 
 @end{Runtime}
 
 @begin{Examples}
+@begin{Example}
+@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0269-1]}
+@ChgAdded{Version=[3],Text=[-- @Examcom{Array component iterator example:}
+@key[for] Element @key[of] Board @key[loop]  -- @Examcom{See @RefSecNum{Index Constraints and Discrete Ranges}.}
+   Element := Element * 2.0; -- @Examcom{Double each element of Board, a two-dimensional array.}
+@key[end loop];]}
+@end{Example}
+
 @ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0268-1]}
 @ChgAdded{Version=[3],Text=[For examples of use of generalized iterators,
 see @RefSecNum{Example of Container Use} and the corresponding container

Questions? Ask the ACAA Technical Agent