CVS difference for ai05s/ai05-0212-1.txt

Differences between 1.5 and version 1.6
Log of other versions for file ai05s/ai05-0212-1.txt

--- ai05s/ai05-0212-1.txt	2011/03/08 23:59:38	1.5
+++ ai05s/ai05-0212-1.txt	2011/03/09 00:46:29	1.6
@@ -1,4 +1,5 @@
-!standard A.18.2(9/2)                                  11-02-16  AI05-0212-1/05
+!standard A.18.2(9/2)                                  11-03-08  AI05-0212-1/06
+!standard A.18.33(0)
 !class Amendment 10-04-26
 !status work item 10-04-26
 !status received 10-02-27
@@ -24,13 +25,24 @@
 
 [Editor's note: The following is based on AI05-0139-2/07.]
 
+
+Replace 7.6(4/1) with:
+
+    package Finalization is
+        pragma Pure(Finalization);
+
+[This changes this to a Pure package, and drops "Remote_Types" (which is implicit
+in Pure).]
+
 Add the following with to each container package:
 
    with Ada.Iterator_Interfaces;
 
 
 Modify the definition of the container types for each of the containers
-(with suitable substitutions for the names of types) as follows:
+(with suitable substitutions for the names of types) as follows [note:
+Set does not have Variable_Indexing as it does not allow in-place
+modification of elements]:
 
       type Vector is tagged private
          with
@@ -51,12 +63,11 @@
 immediately after Update_Element (with suitable substitutions for the names of types):
 
     type Constant_Reference_Type (Element : not null access constant Element_Type) is
-       with private
+       private
        with
           Implicit_Dereference => Element;
 
-    type Reference_Type (Element : not null access Element_Type) is
-       with private
+    type Reference_Type (Element : not null access Element_Type) is private
        with
           Implicit_Dereference => Element;
 
@@ -72,13 +83,15 @@
 this case would take extra work, we define it to raise an exception.
 
 Add the following to each Ada.Containers package that has a Cursor type
-immediately after the above (with suitable substitutions for the names of types):
+immediately after the above (with suitable substitutions for the names of types) -
+exception: there is no Reference in package Sets [meta-rule: There is a Constant_Reference
+for each Query_Element; a Reference for each Update_Element]:
 
     function Constant_Reference (Container : aliased in Vector; Position : in Cursor)
        return Constant_Reference_Type;
 
 This function (combined with the Constant_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read access to the individual elements of
+provides a convenient way to get read access to the individual elements of
 a container starting with a cursor.
 
 If Position equals No_Element, then Constraint_Error is propagated; if Position
@@ -92,7 +105,7 @@
        return Reference_Type;
 
 This function (combined with the Variable_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read and write access to the individual elements of
+provides a convenient way to get read and write access to the individual elements of
 a container starting with a cursor.
 
 If Position equals No_Element, then Constraint_Error is propagated; if Position
@@ -111,7 +124,7 @@
        return Constant_Reference_Type;
 
 This routine (combined with the Constant_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read access to the individual elements of
+provides a convenient way to get read access to the individual elements of
 a container starting with an index value.
 
 If Index is not in the range First_Index (Container) .. Last_Index (Container),
@@ -124,7 +137,7 @@
        return Reference_Type;
 
 This function (combined with the Variable_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read and write access to the individual elements of
+provides a convenient way to get read and write access to the individual elements of
 a container starting with an index value.
 
 If Index is not in the range First_Index (Container) .. Last_Index (Container),
@@ -136,14 +149,14 @@
 The element designated by Position is not an empty element after successful
 completion of this operation.
 
-Add the following to Ada.Containers.Hashed_Maps and the various other Map containers,
-as well as inside of the Generic_Keys package for the various Set containers:
 
+Add the following to Ada.Containers.Hashed_Maps and the various other Map containers:
+
     function Constant_Reference (Container : aliased in Map; Key : in Key_Type)
        return Constant_Reference_Type;
 
 This routine (combined with the Constant_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read access to the individual elements of
+provides a convenient way to get read access to the individual elements of
 a container starting with a key value.
 
 Equivalent to Constant_Reference (Container, Find (Container, Key)).
@@ -152,19 +165,60 @@
        return Reference_Type;
 
 This function (combined with the Variable_Indexing and Implicit_Dereference aspects)
-provides a convinient way to get read and write access to the individual elements of
-a container starting with an index value.
+provides a convenient way to get read and write access to the individual elements of
+a container starting with an key value.
 
 Equivalent to Reference (Container, Find (Container, Key)).
 
+
+Add the following as inside of the Generic_Keys package for the various Set
+containers:
+
+[Note: Reference_Type is also declared inside of package Generic_Keys.]
+
+    function Reference_Preserving_Key (Container : aliased in out Set; Position : in Cursor)
+       return Reference_Type;
+
+This function (combined with the Implicit_Dereference aspect)
+provides a convenient way to get read and write access to the individual elements of
+a container starting with an key value.
+
+If Position equals No_Element, then Constraint_Error is propagated; if Position
+does not designate an element in Container, then Program_Error is propagated.
+Otherwise, Reference_Preserving_Key uses Key to save the key value *K*; then returns
+an object whose discriminant is an access value that designates the element designated
+by Position. Program_Error is propagated if any operation tampers with the elements of
+Container while the object returned by Reference_Preserving_Key exists and has not been
+finalized. When the object returned by Reference_PReserving_Key is finalized, a check
+is made if *K* determines the same equivalence class as that for the new element; if not,
+the element is removed from the set and Program_Error is propagated.
+
+
+    function Constant_Reference (Container : aliased in Set; Key : in Key_Type)
+       return Constant_Reference_Type;
+
+This routine (combined with the Implicit_Dereference aspect)
+provides a convenient way to get read access to the individual elements of
+a container starting with a key value.
+
+Equivalent to Constant_Reference (Container, Find (Container, Key)).
+
+    function Reference_Preserving_Key (Container : aliased in out Set; Key : in Key_Type)
+       return Reference_Type;
+
+This function (combined with the Implicit_Dereference aspect)
+provides a convenient way to get read and write access to the individual elements of
+a container starting with an key value.
+
+Equivalent to Reference_Preserving_Key (Container, Find (Container, Key)).
+
+
 [Note: The versions for the set containers are unfortunately not primitive operations;
-therefore they cannot be used via the _Indexing magic nor can they be called with
-prefix notation. However, the reference semantics is operational, so the discriminant
+therefore they cannot be used via the _Indexing magic nor can they be called with prefix
+notation. However, the reference semantics is operational, so the discriminant
 and .all can be omitted; and they're probably still easier to use than Update_Element.
-That seems like enough to justify defining them.
+That seems like enough to justify defining them.]
 
-The Reference function for a Set and Key may need to work like the
-Update_Element_Preserving_Key routine. More thought needed.]
 
 Add the following to Ada.Containers.Indefinite_Holders and its relatives:
 
@@ -172,7 +226,7 @@
        return Constant_Reference_Type;
 
 This routine (combined with the Implicit_Dereference aspect)
-provides a convinient way to get read access to the contained element of
+provides a convenient way to get read access to the contained element of
 a holder container.
 
 If Container is empty, Constraint_Error is propagated. Otherwise, Constant_Reference
@@ -183,7 +237,7 @@
 
     function Reference (Container : aliased in out Holder) return Reference_Type;
 
-This function (combined with the Implicit_Dereference aspects) provides a convinient
+This function (combined with the Implicit_Dereference aspects) provides a convenient
 way to get read and write access to the contained element of a holder container.
 
 If Container is empty, Constraint_Error is propagated. Otherwise, Reference returns
@@ -281,21 +335,9 @@
       the sequence_of_statements of the loop_statement whose iterator_specification denotes
       this object) tampers with the cursors of Container while the returned object exists. The returned
       object from Iterate needs finalization.
-
-For each bounded container, delete the bullet and associated implementation note that says:
-
-The pragma Preelaborate is replaced with pragma Pure.
-
-Add an AARM note after the bullet about when the container needs finalization:
-
-Implementation Note: The type Vector cannot depend on package Ada.Finalization unless the element
-type depends on that package. The objects returned from the Iterator and Reference functions
-probably do depend on package Ada.Finalization. Restricted environments may need to avoid
-use of those functions and their associated types.
 
+Add the following to the Erroneous Execution section of each (unbounded) container package:
 
-Add the following to the Erroneous Execution section of each container package:
-
 Execution is erroneous if the vector associated with the result of a call to
 Reference or Constant_Reference is finalized before the result object returned
 by the call to Reference or Constant_Reference is finalized.
@@ -310,6 +352,20 @@
 question is not visible in the specification of the type. (This is the same
 reason we have to say this for invalid cursors.)
 
+
+For each bounded container, delete AARM implementation note that says:
+
+Package Containers.Bounded_Vectors cannot depend on package Ada.Finalization (because that package has
+Preelaborate categorization). 
+
+Add an AARM note after the bullet about when the container needs finalization:
+
+Implementation Note: The type Vector cannot depend on package Ada.Finalization unless the element
+type depends on that package. The objects returned from the Iterator and Reference functions
+probably do depend on package Ada.Finalization. Restricted environments may need to avoid
+use of those functions and their associated types.
+
+
 Add a new clause at the end of the containers section: (Currently A.18.33)
 
 A.18.33 Example of container use
@@ -418,7 +474,7 @@
 
    So_Far (N) := Distance'Last;
 
-is a convinient short hand for
+is a convenient short hand for
 
    So_Far.Reference (N).Element.all := Distance'Last;
 

Questions? Ask the ACAA Technical Agent