CVS difference for ai12s/ai12-0111-1.txt
--- ai12s/ai12-0111-1.txt 2018/12/07 07:01:27 1.19
+++ ai12s/ai12-0111-1.txt 2018/12/14 08:31:29 1.20
@@ -1,5 +1,7 @@
-!standard A.18.2(97.1/3) 18-12-06 AI12-0111-1/09
+!standard A.18.2(97.1/3) 18-12-11 AI12-0111-1/10
!class Amendment 16-06-06
+!status Amendment 1-2012 18-12-11
+!status ARG Approved 11-0-1 18-12-10
!status work item 14-05-15
!status received 14-02-08
!priority Medium
@@ -155,6 +157,9 @@
procedure of an instance of Generic_Sorting,} with V as a parameter;
or
+ [Editor's note: This is just fixing a bug in the definition of "tampering
+ with cursors" for Vectors.]
+
Replace A.18.2(95/2-97/2) (also do the same with similar paragraphs
elsewhere: A.18.3(67/2-69/2), A.18.4(13/2-15/2), A.18.7(13/2-14/2),
A.18.10(87/3-89/3)) with:
@@ -168,15 +173,9 @@
Insert after A.18.2(79/2):
-[Author's note: Below, we have left in the original paragraph numbers
-from the Vector container because we thought they might be useful, and
-mostly because we are too lazy to remove them.]
-
- ... -- enclosing package Ada.Containers.Vectors
-
package Stable is
-8/3 type Vector (Base : not null access Vectors.Vector) is
+ type Vector (Base : not null access Vectors.Vector) is
tagged limited private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
@@ -184,209 +183,64 @@
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization(Vector);
-9/2 type Cursor is private;
+ type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
-10/2 Empty_Vector : constant Vector;
+ Empty_Vector : constant Vector;
-11/2 No_Element : constant Cursor;
+ No_Element : constant Cursor;
-11.1/3 function Has_Element (Position : Cursor) return Boolean;
+ function Has_Element (Position : Cursor) return Boolean;
-11.2/3 package Vector_Iterator_Interfaces is new
+ package Vector_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
-
-12/2 function "=" (Left, Right : Vector) return Boolean;
-
-13/2 function To_Vector (Length : Count_Type) return Vector;
-
-14/2 function To_Vector
- (New_Item : Element_Type;
- Length : Count_Type) return Vector;
-
-15/2 function "&" (Left, Right : Vector) return Vector;
-
-16/2 function "&" (Left : Vector;
- Right : Element_Type) return Vector;
-
-17/2 function "&" (Left : Element_Type;
- Right : Vector) return Vector;
-
-18/2 function "&" (Left, Right : Element_Type) return Vector;
-
-19/2 function Capacity (Container : Vector) return Count_Type;
-
-21/2 function Length (Container : Vector) return Count_Type;
-
-23/2 function Is_Empty (Container : Vector) return Boolean;
-
-25/2 function To_Cursor (Container : Vector;
- Index : Extended_Index) return Cursor;
-26/2 function To_Index (Position : Cursor) return Extended_Index;
-
-27/2 function Element (Container : Vector;
- Index : Index_Type)
- return Element_Type;
-
-28/2 function Element (Position : Cursor) return Element_Type;
-
-29/2 procedure Replace_Element (Container : in out Vector;
- Index : in Index_Type;
- New_Item : in Element_Type);
-
-30/2 procedure Replace_Element (Container : in out Vector;
- Position : in Cursor;
- New_item : in Element_Type);
-
-31/2 procedure Query_Element
- (Container : in Vector;
- Index : in Index_Type;
- Process : not null access procedure
- (Element : in Element_Type));
-
-32/2 procedure Query_Element
- (Position : in Cursor;
- Process : not null access procedure (Element : in Element_Type));
-
-33/2 procedure Update_Element
- (Container : in out Vector;
- Index : in Index_Type;
- Process : not null access procedure
- (Element : in out Element_Type));
+ procedure Assign (Target : in out Vectors.Vector;
+ Source : in Vector);
-34/2 procedure Update_Element
- (Container : in out Vector;
- Position : in Cursor;
- Process : not null access procedure
- (Element : in out Element_Type));
+ function Copy (Source : Vectors.Vector) return Vector;
-34.1/3 type Constant_Reference_Type
+ type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
-34.2/3 type Reference_Type
+ type Reference_Type
(Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
-
-34.3/3 function Constant_Reference (Container : aliased in Vector;
- Index : in Index_Type)
- return Constant_Reference_Type;
-
-34.4/3 function Reference (Container : aliased in out Vector;
- Index : in Index_Type)
- return Reference_Type;
-
-34.5/3 function Constant_Reference (Container : aliased in Vector;
- Position : in Cursor)
- return Constant_Reference_Type;
-
-34.6/3 function Reference (Container : aliased in out Vector;
- Position : in Cursor)
- return Reference_Type;
-
-34.7/3 procedure Assign (Target : in out Vectors.Vector;
- Source : in Vector);
-
-34.8/3 function Copy (Source : Vector)
- return Vector;
-
- function Copy (Source : Vectors.Vector)
- return Vector;
-54/2 procedure Reverse_Elements (Container : in out Vector);
+ -- Additional subprograms as described in the text are declared
+ -- here.
-55/2 procedure Swap (Container : in out Vector;
- I, J : in Index_Type);
+ private
-56/2 procedure Swap (Container : in out Vector;
- I, J : in Cursor);
+ ... -- not specified by the language
-57/2 function First_Index (Container : Vector) return Index_Type;
+ end Stable;
-58/2 function First (Container : Vector) return Cursor;
-59/2 function First_Element (Container : Vector)
- return Element_Type;
+Insert the following after A.18.2(237/2):
-60/2 function Last_Index (Container : Vector) return Extended_Index;
-
-61/2 function Last (Container : Vector) return Cursor;
-
-62/2 function Last_Element (Container : Vector)
- return Element_Type;
-
-63/2 function Next (Position : Cursor) return Cursor;
-
-64/2 procedure Next (Position : in out Cursor);
-
-65/2 function Previous (Position : Cursor) return Cursor;
-
-66/2 procedure Previous (Position : in out Cursor);
-
-67/2 function Find_Index (Container : Vector;
- Item : Element_Type;
- Index : Index_Type := Index_Type'First)
- return Extended_Index;
-
-68/2 function Find (Container : Vector;
- Item : Element_Type;
- Position : Cursor := No_Element)
- return Cursor;
-
-69/2 function Reverse_Find_Index (Container : Vector;
- Item : Element_Type;
- Index : Index_Type := Index_Type'Last)
- return Extended_Index;
-
-70/2 function Reverse_Find (Container : Vector;
- Item : Element_Type;
- Position : Cursor := No_Element)
- return Cursor;
-
-71/2 function Contains (Container : Vector;
- Item : Element_Type) return Boolean;
-
-73/2 procedure Iterate
- (Container : in Vector;
- Process : not null access procedure (Position : in Cursor));
-
-74/2 procedure Reverse_Iterate
- (Container : in Vector;
- Process : not null access procedure (Position : in Cursor));
-
-74.1/3 function Iterate (Container : in Vector)
- return Vector_Iterator_Interfaces.Reversible_Iterator'Class;
-
-74.2/3 function Iterate (Container : in Vector; Start : in Cursor)
- return Vector_Iterator_Interfaces.Reversible_Iterator'Class;
-
-75/2 generic
- with function "<" (Left, Right : Element_Type)
- return Boolean is <>;
- package Generic_Sorting is
-
-76/2 function Is_Sorted (Container : Vector) return Boolean;
-
-77/2 procedure Sort (Container : in out Vector);
-
-79/2 end Generic_Sorting;
-
-80/2 private
-
-81/2 ... -- not specified by the language
-
-82/2 end Stable;
-
-
-Insert the following at the end of A.18.2:
-
The nested package Vectors.Stable
provides a type Stable.Vector that represents
- a /stable/ vector, which is one that cannot grow and shrink. Such a
+ a /stable/ vector, which is one that cannot grow and shrink. Such a
vector can be created by calling the To_Vector or Copy functions, or
by establishing a /stabilized view/ of a regular Vector.
+ The subprograms of package Containers.Vectors that have a parameter
+ or result of type Vector are included in the nested package Stable
+ with the same specification, except that the following are omitted:
+ Assign, Move, Insert, Insert_Space, Clear, Delete, and Set_Length
+ Generic package Generic_Sorting is also included with the same
+ specification, except that Merge is omitted.
+
+ AARM Ramification: The names Vector and Cursor mean the types
+ declared in the nested package in these subprogram specifications.
+
+ AARM Reason: The omitted routines are those that tamper with elements.
+ The model is that it is impossible to tamper with elements of a stable
+ view since no such operations are included. Thus tampering checks are
+ not needed for a stable view.
+
The operations of this package are equivalent to those for regular
Vectors, except that no tampering checks are performed on stable
Vectors. If a stable
@@ -408,6 +262,7 @@
is zero. The Length of a stable vector never changes after
initialization.
+
Add in the Indefinite_Vectors section, after A.18.11(9/4):
* The operations Replace_Element, Reverse_Elements, and Swap, and the
nested generic unit Generic_Sorting are omitted from the nested
@@ -432,15 +287,9 @@
Insert after A.18.3(51/2):
-[Author's note: Below, we have left in the original paragraph numbers
-from the Vector container because we thought they might be useful, and
-mostly because we are too lazy to remove them.]
-
- ... -- enclosing package Ada.Containers.Doubly_Linked_Lists
-
package Stable is
-8/3 type List (Base : not null access Doubly_Linked_Lists.List) is
+ type List (Base : not null access Doubly_Linked_Lists.List) is
tagged limited private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
@@ -448,158 +297,72 @@
Iterator_Element => Element_Type;
pragma Preelaborable_Initialization(List);
-9/2 type Cursor is private;
+ type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
-10/2 Empty_List : constant List;
+ Empty_List : constant List;
-11/2 No_Element : constant Cursor;
+ No_Element : constant Cursor;
-11.1/3 function Has_Element (Position : Cursor) return Boolean;
+ function Has_Element (Position : Cursor) return Boolean;
-11.2/3 package List_Iterator_Interfaces is new
+ package List_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
-
-12/2 function "=" (Left, Right : List) return Boolean;
-
-21/2 function Length (Container : List) return Count_Type;
-
-23/2 function Is_Empty (Container : List) return Boolean;
-
-28/2 function Element (Position : Cursor) return Element_Type;
-
-30/2 procedure Replace_Element (Container : in out List;
- Position : in Cursor;
- New_item : in Element_Type);
-32/2 procedure Query_Element
- (Position : in Cursor;
- Process : not null access procedure (Element : in Element_Type));
-
-34/2 procedure Update_Element
- (Container : in out List;
- Position : in Cursor;
- Process : not null access procedure
- (Element : in out Element_Type));
-
-34.1/3 type Constant_Reference_Type
+ type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
-34.2/3 type Reference_Type
- (Element : not null access Element_Type) is private
+ type Reference_Type
+ (Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
-
-34.5/3 function Constant_Reference (Container : aliased in List;
- Position : in Cursor)
- return Constant_Reference_Type;
-
-34.6/3 function Reference (Container : aliased in out List;
- Position : in Cursor)
- return Reference_Type;
-34.7/3 procedure Assign (Target : in out Doubly_Linked_Lists.List;
+ procedure Assign (Target : in out Doubly_Linked_Lists.List;
Source : in List);
-34.8/3 function Copy (Source : List)
- return List;
-
function Copy (Source : Doubly_Linked_Lists.List)
return List;
-
-54/2 procedure Reverse_Elements (Container : in out List);
-
-56/2 procedure Swap (Container : in out List;
- I, J : in Cursor);
-
-58/2 function First (Container : List) return Cursor;
-
-59/2 function First_Element (Container : List)
- return Element_Type;
-
-61/2 function Last (Container : List) return Cursor;
-
-62/2 function Last_Element (Container : List)
- return Element_Type;
-
-63/2 function Next (Position : Cursor) return Cursor;
-
-64/2 procedure Next (Position : in out Cursor);
-
-65/2 function Previous (Position : Cursor) return Cursor;
-
-66/2 procedure Previous (Position : in out Cursor);
-
-68/2 function Find (Container : List;
- Item : Element_Type;
- Position : Cursor := No_Element)
- return Cursor;
-
-70/2 function Reverse_Find (Container : List;
- Item : Element_Type;
- Position : Cursor := No_Element)
- return Cursor;
-
-71/2 function Contains (Container : List;
- Item : Element_Type) return Boolean;
-
-73/2 procedure Iterate
- (Container : in List;
- Process : not null access procedure (Position : in Cursor));
-74/2 procedure Reverse_Iterate
- (Container : in List;
- Process : not null access procedure (Position : in Cursor));
+ -- Additional subprograms as described in the text are declared
+ -- here.
-74.1/3 function Iterate (Container : in List)
- return List_Iterator_Interfaces.Reversible_Iterator'Class;
+ private
-74.2/3 function Iterate (Container : in List; Start : in Cursor)
- return List_Iterator_Interfaces.Reversible_Iterator'Class;
+ ... -- not specified by the language
-75/2 generic
- with function "<" (Left, Right : Element_Type)
- return Boolean is <>;
- package Generic_Sorting is
+ end Stable;
-76/2 function Is_Sorted (Container : List) return Boolean;
+Modify A.18.3(63/2):
-77/2 procedure Sort (Container : in out List);
+ * it inserts or deletes elements of L, that is, it calls the Insert, Clear,
+ Delete, {Delete_First,} or Delete_Last procedures with L as a parameter;
+ or
-79/2 end Generic_Sorting;
+ [Editor's note: This just fixes a bug in the definition of tampering with
+ cursors for Lists.]
-80/2 private
+Insert new section after A.18.3(151/3):
-81/2 ... -- not specified by the language
-
-82/2 end Stable;
-
- private
- ... -- not specified by the language
- end Ada.Containers.Doubly_Linked_Lists;
-
-
-Delete A.18.3(67/2-69/2).
-
-Modify A.18.3(69.1/4) as follows:
-
- When tampering with cursors is prohibited for a particular list object
- L, Program_Error is propagated by a call of any language-defined
- subprogram that is defined to tamper with the cursors of L, leaving L
- unmodified. [Similarly, when tampering with elements is prohibited for
- a particular list object L, Program_Error is propagated by a call of
- any language-defined subprogram that is defined to tamper with the
- elements of L (or tamper with the cursors of L), leaving L unmodified.]
- These checks are made before any other defined behavior of the body of
- the language-defined subprogram.
-
-Insert new section at the end of A.18.3:
-
The nested package Doubly_Linked_Lists.Stable
provides a type Stable.List that represents
- a /stable/ list, which is one that cannot grow and shrink. Such a
- list can be created by calling the To_Vector or Copy functions, or
- by establishing a /stabilized view/ of a regular Vector.
+ a /stable/ list, which is one that cannot grow and shrink. Such a
+ list can be created by calling the Copy functions, or
+ by establishing a /stabilized view/ of a regular List.
+
+ The subprograms of package Containers.Doubly_Linked_Lists that have a
+ parameter or result of type List are included in the nested package Stable
+ with the same specification, except for the following:
+ Assign, Move, Insert, Clear, Delete, Delete_Last, Splice, Swap_Links,
+ and Reverse_Elements
+
+ AARM Ramification: The names List and Cursor mean the types
+ declared in the nested package in these subprogram specifications.
+
+ AARM Reason: The omitted routines are those that tamper with elements.
+ The model is that it is impossible to tamper with elements of a stable
+ view since no such operations are included. Thus tampering checks are
+ not needed for a stable view. For this reason, the Generic_Sorting
+ generic is omitted completely.
The operations of this package are equivalent to those for regular
Doubly_Linked_Lists, except that no tampering checks are performed
@@ -616,11 +379,10 @@
or stabilized views)].
If a stable list is declared without specifying Base, the object must
- be initialized. The initializing expression of
- the stable list, Redundant[typically a call on To_Vector or
- Copy], determines the Length of the list. By default the Length
- is zero. The Length of a stable list never changes after
- initialization.
+ be initialized. The initializing expression of the stable list,
+ Redundant[typically a call on Copy], determines the Length of the list.
+ By default the Length is zero. The Length of a stable list never changes
+ after initialization.
-----
@@ -645,17 +407,28 @@
---
-In section A.18.4 on Maps, modify A.18.4(13/2) as follows:
- * A subprogram is said to tamper with elements of a map object M if {the
- formal Element_Type is indefinite (see A.18.13 and A.18.14), and}:
+Insert after A.18.4(75/3):
-Insert at end of A.18.4:
-
The nested package Stable provides a type Stable.Map that represents
- a /stable/ map, which is one that cannot grow and shrink. Such a
+ a /stable/ map, which is one that cannot grow and shrink. Such a
map can be created by calling the Copy functions, or
by establishing a /stabilized view/ of a regular Map.
+ The subprograms of the map package that have a parameter
+ or result of type Map are included in the nested package Stable
+ with the same specification, except that the following are omitted:
+ Assign, Move, Insert, Include, Clear, Delete, Exclude,
+ (for Ordered_Maps) Delete_First, Delete_Last,
+ and (for Hashed_Maps) Reserve_Capacity
+
+ AARM Ramification: The names Map and Cursor mean the types
+ declared in the nested package in these subprogram specifications.
+
+ AARM Reason: The omitted routines are those that tamper with elements.
+ The model is that it is impossible to tamper with elements of a stable
+ view since no such operations are included. Thus tampering checks are
+ not needed for a stable view.
+
The operations of this package are equivalent to those for regular
Hashed_Maps, except that no tampering checks are performed on
stable maps. If a stable
@@ -664,7 +437,7 @@
stabilized view of the underlying regular map, and any operation
on the stable map is reflected on the underlying regular map.
While a stabilized view exists, any operation that tampers with
- elements performed on the underlying map is prohibited. The
+ elements performed on the underlying map is prohibited. The
finalization of a stable map that provides such a view removes
this restriction on the underlying regular map Redundant[(though
some other restriction might exist due to other concurrent iterations
@@ -679,297 +452,89 @@
Insert after A.18.5(38/2):
-[Author's note: Below, we have left in the original paragraph numbers
-from the Hashed_Maps container because we thought they might be useful, and
-mostly because we are too lazy to remove them.]
-
package Stable is
-3/3
type Map (Base : not null access Hashed_Maps.Map) is
tagged limited private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
-4/2
+
type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
-5/2
+
Empty_Map : constant Map;
-6/2
+
No_Element : constant Cursor;
-6.1/3
+
function Has_Element (Position : Cursor) return Boolean;
-6.2/3
+
package Map_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
-7/2
- function "=" (Left, Right : Map) return Boolean;
-8/2
- function Capacity (Container : Map) return Count_Type;
-9/2
- procedure Reserve_Capacity (Container : in out Map;
- Capacity : in Count_Type);
-10/2
- function Length (Container : Map) return Count_Type;
-11/2
- function Is_Empty (Container : Map) return Boolean;
-12/2
- procedure Clear (Container : in out Map);
-13/2
- function Key (Position : Cursor) return Key_Type;
-14/2
- function Element (Position : Cursor) return Element_Type;
-15/2
- procedure Replace_Element (Container : in out Map;
- Position : in Cursor;
- New_Item : in Element_Type);
-16/2
- procedure Query_Element
- (Position : in Cursor;
- Process : not null access procedure (Key : in Key_Type;
- Element : in Element_Type));
-17/2
- procedure Update_Element
- (Container : in out Map;
- Position : in Cursor;
- Process : not null access procedure
- (Key : in Key_Type;
- Element : in out Element_Type));
-17.1/3
+
type Constant_Reference_Type
(Element : not null access constant Element_Type) is private
with Implicit_Dereference => Element;
-17.2/3
+
type Reference_Type (Element : not null access Element_Type) is private
with Implicit_Dereference => Element;
-17.3/3
- function Constant_Reference (Container : aliased in Map;
- Position : in Cursor)
- return Constant_Reference_Type;
-17.4/3
- function Reference (Container : aliased in out Map;
- Position : in Cursor)
- return Reference_Type;
-17.5/3
- function Constant_Reference (Container : aliased in Map;
- Key : in Key_Type)
- return Constant_Reference_Type;
-17.6/3
- function Reference (Container : aliased in out Map;
- Key : in Key_Type)
- return Reference_Type;
-17.7/3
procedure Assign (Target : in out Hashed_Map.Map;
Source : in Map);
-17.8/3
- function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
+ function Copy (Source : Hashed_Map.Map) return Map;
- procedure Replace (Container : in out Map;
- Key : in Key_Type;
- New_Item : in Element_Type);
-27/2
- function First (Container : Map)
- return Cursor;
-28/2
- function Next (Position : Cursor) return Cursor;
-29/2
- procedure Next (Position : in out Cursor);
-30/2
- function Find (Container : Map;
- Key : Key_Type)
- return Cursor;
-31/2
- function Element (Container : Map;
- Key : Key_Type)
- return Element_Type;
-32/2
- function Contains (Container : Map;
- Key : Key_Type) return Boolean;
-34/2
- function Equivalent_Keys (Left, Right : Cursor)
- return Boolean;
-35/2
- function Equivalent_Keys (Left : Cursor;
- Right : Key_Type)
- return Boolean;
-36/2
- function Equivalent_Keys (Left : Key_Type;
- Right : Cursor)
- return Boolean;
-37/2
- procedure Iterate
- (Container : in Map;
- Process : not null access procedure (Position : in Cursor));
-37.1/3
- function Iterate (Container : in Map)
- return Map_Iterator_Interfaces.Forward_Iterator'Class;
-38/2
+ -- Additional subprograms as described in the text are declared
+ -- here.
+
private
-39/2
+
... -- not specified by the language
-40/2
+
end Stable;
----
Insert after A.18.6(51.2/3):
-[Author's note: Below, we have left in the original paragraph numbers
-from the Ordered_Maps container because we thought they might be useful, and
-mostly because we are too lazy to remove them.]
-
package Stable is
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
-4/3
+
type Map (Base : not null access Ordered_Maps.Map) is
is tagged limited private
with Constant_Indexing => Constant_Reference,
Variable_Indexing => Reference,
Default_Iterator => Iterate,
Iterator_Element => Element_Type;
-5/2
+
type Cursor is private;
pragma Preelaborable_Initialization(Cursor);
-6/2
+
Empty_Map : constant Map;
-7/2
+
No_Element : constant Cursor;
-7.1/3
+
function Has_Element (Position : Cursor) return Boolean;
-7.2/3
+
package Map_Iterator_Interfaces is new
Ada.Iterator_Interfaces (Cursor, Has_Element);
-8/2
- function "=" (Left, Right : Map) return Boolean;
-9/2
- function Length (Container : Map) return Count_Type;
-10/2
- function Is_Empty (Container : Map) return Boolean;
-12/2
- function Key (Position : Cursor) return Key_Type;
-13/2
- function Element (Position : Cursor) return Element_Type;
-14/2
- procedure Replace_Element (Container : in out Map;
- Position : in Cursor;
- New_Item : in Element_Type);
-15/2
- procedure Query_Element
- (Position : in Cursor;
- Process : not null access procedure (Key : in Key_Type;
- Element : in Element_Type));
-16/2
- procedure Update_Element
- (Container : in out Map;
- Position : in Cursor;
- Process : not null access procedure
- (Key : in Key_Type;
- Element : in out Element_Type));
-16.1/3
- type Constant_Reference_Type
- (Element : not null access constant Element_Type) is private
- with Implicit_Dereference => Element;
-16.2/3
- type Reference_Type (Element : not null access Element_Type) is private
- with Implicit_Dereference => Element;
-16.3/3
- function Constant_Reference (Container : aliased in Map;
- Position : in Cursor)
- return Constant_Reference_Type;
-16.4/3
- function Reference (Container : aliased in out Map;
- Position : in Cursor)
- return Reference_Type;
-16.5/3
- function Constant_Reference (Container : aliased in Map;
- Key : in Key_Type)
- return Constant_Reference_Type;
-16.6/3
- function Reference (Container : aliased in out Map;
- Key : in Key_Type)
- return Reference_Type;
-16.7/3
+
procedure Assign (Target : in out Ordered_Map.Map;
Source : in Map);
-16.8/3
- function Copy (Source : Map) return Map;
-22/2
- procedure Replace (Container : in out Map;
- Key : in Key_Type;
- New_Item : in Element_Type);
-28/2
- function First (Container : Map) return Cursor;
-29/2
- function First_Element (Container : Map) return Element_Type;
-30/2
- function First_Key (Container : Map) return Key_Type;
-31/2
- function Last (Container : Map) return Cursor;
-32/2
- function Last_Element (Container : Map) return Element_Type;
-33/2
- function Last_Key (Container : Map) return Key_Type;
-34/2
- function Next (Position : Cursor) return Cursor;
-35/2
- procedure Next (Position : in out Cursor);
-36/2
- function Previous (Position : Cursor) return Cursor;
-37/2
- procedure Previous (Position : in out Cursor);
-38/2
- function Find (Container : Map;
- Key : Key_Type) return Cursor;
-39/2
- function Element (Container : Map;
- Key : Key_Type) return Element_Type;
-40/2
- function Floor (Container : Map;
- Key : Key_Type) return Cursor;
-41/2
- function Ceiling (Container : Map;
- Key : Key_Type) return Cursor;
-42/2
- function Contains (Container : Map;
- Key : Key_Type) return Boolean;
-44/2
- function "<" (Left, Right : Cursor) return Boolean;
-45/2
- function ">" (Left, Right : Cursor) return Boolean;
-46/2
- function "<" (Left : Cursor; Right : Key_Type) return Boolean;
-47/2
- function ">" (Left : Cursor; Right : Key_Type) return Boolean;
-48/2
- function "<" (Left : Key_Type; Right : Cursor) return Boolean;
-49/2
- function ">" (Left : Key_Type; Right : Cursor) return Boolean;
-50/2
- procedure Iterate
- (Container : in Map;
- Process : not null access procedure (Position : in Cursor));
-51/2
- procedure Reverse_Iterate
- (Container : in Map;
- Process : not null access procedure (Position : in Cursor));
-51.1/3
- function Iterate (Container : in Map)
- return Map_Iterator_Interfaces.Reversible_Iterator'Class;
-51.2/3
- function Iterate (Container : in Map; Start : in Cursor)
- return Map_Iterator_Interfaces.Reversible_Iterator'Class;
-52/2
+
+ function Copy (Source : Ordered_Map.Map) return Map;
+
+ -- Additional subprograms as described in the text are declared
+ -- here.
+
private
-53/2
+
... -- not specified by the language
-54/2
+
end Stable;
-55/2
+
In the section on Indefinite_Hashed_Maps, A.18.13, add after para 9/4:
@@ -1002,14 +567,43 @@
element is not a problem, so Update_Element does not cause a problem.
----
+
+Add after A.18.7(9/2):
+
+ * it calls procedures Union, Intersection, Difference, or Symmetric_Difference
+ with a target parameter of S;
-Insert at end of A.18.7:
+ AARM Discussion: This only includes the procedure versions of these routines;
+ the function versions do not tamper with cursors.
+ [This is fixing an arguable bug in the definition of tampering with cursors - Editor.]
+
+Insert after A.18.7(96.12/3):
+
The nested package Stable provides a type Stable.Set that represents
a /stable/ set, which is one that cannot grow and shrink. Such a
set can be created by calling the Copy functions, or
by establishing a /stabilized view/ of a regular Set.
+ The subprograms of package the set package that have a parameter
+ or result of type Set are included in the nested package Stable
+ with the same specification, except that the following are omitted:
+ Assign, Move, Insert, Include, Clear, Delete, Exclude,
+ Replace_Element, Union, Intersection, Difference,
+ Symmetric_Difference, (for Ordered_Maps) Delete_First, Delete_Last,
+ and (for Hashed_Maps) Reserve_Capacity
+
+ AARM Discussion: The Generic_Keys package is not included in the
+ Stable package.
+
+ AARM Ramification: The names Set and Cursor mean the types
+ declared in the nested package in these subprogram specifications.
+
+ AARM Reason: The omitted routines are those that tamper with elements.
+ The model is that it is impossible to tamper with elements of a stable
+ view since no such operations are included. Thus tampering checks are
+ not needed for a stable view.
+
The operations of this package are equivalent to those for regular
maps, except that no tampering checks are performed on
stable sets. If a stable
@@ -1032,22 +626,89 @@
initialization.
Insert code for Hashed_Sets.Stable after A.18.8(59/2):
+
+package Stable is
+
+ type Set (Base : not null access Hashed_Sets.Set) is
+ tagged limited private
+ with Constant_Indexing => Constant_Reference,
+ Variable_Indexing => Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
+
+ type Cursor is private;
+ pragma Preelaborable_Initialization(Cursor);
+
+ Empty_Set : constant Set;
+
+ No_Element : constant Cursor;
+
+ function Has_Element (Position : Cursor) return Boolean;
-... analogous to Hashed_Maps.Stable, but list of omitted operations is instead:
+ package Set_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
- Procedures Reserve_Capacity, Clear, Replace_Element, Move, Insert,
- Include, Replace, Exclude, Delete, Union, Intersection, Difference, and
- Symmetric_Difference are omitted, as is the nested generic package
- Generic_Keys.
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is private
+ with Implicit_Dereference => Element;
+ type Reference_Type (Element : not null access Element_Type) is private
+ with Implicit_Dereference => Element;
+
+ procedure Assign (Target : in out Hashed_Set.Set;
+ Source : in Set);
+
+ function Copy (Source : Hashed_Set.Set;
+ Capacity : Count_Type := 0) return Set;
+
+ -- Additional subprograms as described in the text are declared
+ -- here.
+
+private
+
+ ... -- not specified by the language
+
+end Stable;
+
Insert code for Ordered_Sets.Stable after A.18.9(74/2):
+
+package Stable is
+
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
+
+ type Set (Base : not null access Ordered_Sets.Set) is
+ is tagged limited private
+ with Constant_Indexing => Constant_Reference,
+ Variable_Indexing => Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
-... analogous to Ordered_Maps.Stable, but list of omitted operations is instead:
+ type Cursor is private;
+ pragma Preelaborable_Initialization(Cursor);
+
+ Empty_Set : constant Set;
+
+ No_Element : constant Cursor;
+
+ function Has_Element (Position : Cursor) return Boolean;
+
+ package Set_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
+
+ procedure Assign (Target : in out Ordered_Set.Set;
+ Source : in Set);
+
+ function Copy (Source : Ordered_Set.Set) return Set;
+
+ -- Additional subprograms as described in the text are declared
+ -- here.
+
+private
+
+ ... -- not specified by the language
+
+end Stable;
- Procedures Reserve_Capacity, Clear, Replace_Element, Move,
- Insert, Include, Replace, Exclude, Delete, Delete_First, Delete_Last,
- Union, Intersection, Difference, and Symmetric_Difference are omitted,
- as is the nested generic package Generic_Keys.
[Author's note: For a Set, there is no additional operations that tamper
with elements. We should move AARM A.18.7(14.a-b/2) into A.18.15 and A.18.16
@@ -1056,19 +717,72 @@
Insert code for Multiway_Trees.Stable after A.18.10(70/3):
-... analogous to Vectors.Stable, but list of omitted operations is instead:
+ package Stable is
+
+ type Tree (Base : not null access Multiway_Trees.Tree) is
+ tagged limited private
+ with Constant_Indexing => Constant_Reference,
+ Variable_Indexing => Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
+ pragma Preelaborable_Initialization(Tree);
- Procedures Clear, Move, Insert_Child, Append_Child,
- Prepend_Child, Delete_Leaf, Delete_Subtree, Delerte_Children,
- Copy_Subtree, Splice_Subtree, and Splice_Children are omitted.
+ type Cursor is private;
+ pragma Preelaborable_Initialization(Cursor);
+
+ Empty_Tree : constant Tree;
-Insert at end of A.18.10:
+ No_Element : constant Cursor;
+ function Has_Element (Position : Cursor) return Boolean;
+
+ package Tree_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
+
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is private
+ with Implicit_Dereference => Element;
+
+ type Reference_Type
+ (Element : not null access Element_Type) is private
+ with Implicit_Dereference => Element;
+
+ procedure Assign (Target : in out Multiway_Trees.Tree;
+ Source : in Tree);
+
+ function Copy (Source : Multiway_Trees.Tree) return Tree;
+
+ -- Additional subprograms as described in the text are declared
+ -- here.
+
+ private
+
+ ... -- not specified by the language
+
+ end Stable;
+
+
+Insert after A.18.10(219/3):
+
The nested package Stable provides a type Stable.Tree that represents
a /stable/ tree, which is one that cannot grow and shrink. Such a
tree can be created by calling the Copy functions, or
by establishing a /stabilized view/ of a regular Tree.
+ The subprograms of package Containers.Multiway_Trees that have a
+ parameter or result of type Tree are included in the nested package Stable
+ with the same specification, except that the following are omitted:
+ Assign, Move, Clear, Delete_Leaf, Insert_Child, Delete_Children,
+ Delete_Subtree, Copy_Subtree, Splice_Subtree, Splice_Children
+
+ AARM Ramification: The names Tree and Cursor mean the types
+ declared in the nested package in these subprogram specifications.
+
+ AARM Reason: The omitted routines are those that tamper with elements.
+ The model is that it is impossible to tamper with elements of a stable
+ view since no such operations are included. Thus tampering checks are
+ not needed for a stable view.
+
The operations of this package are equivalent to those for regular
maps, except that no tampering checks are performed on
stable trees. If a stable tree is declared with the Base discriminant
@@ -1108,7 +822,9 @@
Tampering was primarily intended to prevent erroneous/unspecified
behavior. As part of this AI we have also simplified the rules for
tampering, by eliminating the tampering with elements checks when
-elements are of a definite subtype.
+elements are of a definite subtype. This was done by defining the
+two kinds of tampering checks to be equivalent for the definite
+cases.
More specifically, tampering with cursors was intended to prevent loops from
going off the rails because an element was deleted (which might cause an
Questions? Ask the ACAA Technical Agent