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

Differences between 1.10 and version 1.11
Log of other versions for file ai05s/ai05-0159-1.txt

--- ai05s/ai05-0159-1.txt	2010/05/20 04:05:16	1.10
+++ ai05s/ai05-0159-1.txt	2010/06/13 04:41:19	1.11
@@ -1,4 +1,4 @@
-!standard  A.18.24                                 10-05-19    AI05-0159-1/07
+!standard  A.18.27                                 10-06-07    AI05-0159-1/08
 !class Amendment 05-10-24
 !status work item 10-04-29
 !status ARG Approved  11-0-0  10-02-27
@@ -29,7 +29,7 @@
 
 !wording
 
-A.18.23 Containers.Synchronized_Queue_Interfaces
+A.18.27 Containers.Synchronized_Queue_Interfaces
 
 The language-defined generic package Containers.Synchronized_Queue_Interfaces
 provides interface type Queue, and a set of operations for that type.
@@ -91,7 +91,7 @@
 any one time.
 
 
-A.18.24 Containers.Unbounded_Synchronized_Queues
+A.18.28 Containers.Unbounded_Synchronized_Queues
 
 Static Semantics
 
@@ -111,9 +111,12 @@
          new Queue_Interfaces.Queue with
       pragma Priority(Ceiling);
 
-      entry Enqueue(Container: in out Queue; New_Item: Element_Type);
-      entry Dequeue(Container: in out Queue; Element: out Element_Type);
+      entry Enqueue(New_Item: Queue_Interfaces.Element_Type);
+      entry Dequeue(Element: out Queue_Interfaces.Element_Type);
 
+      function Current_Use return Count_Type;
+      function Peak_Use return Count_Type;
+
    private
       -- not specified by the language
    end Queue;
@@ -122,16 +125,16 @@
    -- not specified by the language
 end Ada.Containers.Unbounded_Synchronized_Queues;
 
-The type Queue is used to represent task-safe queues. The type Queue needs
-finalization (see 7.6).
+The type Queue is used to represent task-safe queues.
 
 The capacity for instances of type Queue is unbounded.
 
 AARM Ramification: Enqueue never blocks; if more storage is needed for a new
-element, it is allocated dynamically.
+element, it is allocated dynamically. We don't need to explicitly specify that
+Queue needs finalization, because it is visibly protected.
 
 
-A.18.25  Containers.Bounded_Synchronized_Queues
+A.18.29  Containers.Bounded_Synchronized_Queues
 
 Static Semantics
 
@@ -153,9 +156,12 @@
          Ceiling: System.Any_Priority := Default_Ceiling) is
          new Queue_Interfaces.Queue with
       pragma Priority(Ceiling);
+
+      entry Enqueue(New_Item: Queue_Interfaces.Element_Type);
+      entry Dequeue(Element: out Queue_Interfaces.Element_Type);
 
-      entry Enqueue(Container: in out Queue; New_Item: Element_Type);
-      entry Dequeue(Container: in out Queue; Element: out Element_Type);
+      function Current_Use return Count_Type;
+      function Peak_Use return Count_Type;
 
    private
       -- not specified by the language
@@ -168,9 +174,6 @@
 The semantics are the same as for Unbounded_Synchronized_Queues,
 except:
 
-    - The type Queue needs finalization (see 7.6) if and only if Element_Type
-      needs finalization.
-
     - The capacity for instances of type Queue is bounded and specified by the
       discriminant Capacity.
 
@@ -183,7 +186,7 @@
 allocation.
 
 
-A.18.26 Containers.Unbounded_Priority_Queues
+A.18.30 Containers.Unbounded_Priority_Queues
 
 Static Semantics
 
@@ -197,8 +200,8 @@
    with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
    type Queue_Priority is private;
    with function Get_Priority
-     (Element: Queues.Element_Type) return Queue_Priority is <>;
-   with function "<"
+     (Element: Queue_Interfaces.Element_Type) return Queue_Priority is <>;
+   with function Before
      (Left, Right : Queue_Priority) return Boolean is <>;
    Default_Ceiling: System.Any_Priority := System.Priority'Last;
 package Ada.Containers.Unbounded_Priority_Queues is
@@ -209,13 +212,15 @@
          new Queue_Interfaces.Queue with
       pragma Priority(Ceiling);
 
-      entry Enqueue(Container: in out Queue; New_Item: Element_Type);
-      entry Dequeue(Container: in out Queue; Element: out Element_Type);
+      entry Enqueue(New_Item: Queue_Interfaces.Element_Type);
+      entry Dequeue(Element: out Queue_Interfaces.Element_Type);
 
       entry Dequeue_Only_High_Priority
-        (Container          : in out Queue;
-         Minimum_Priority   :        Queue_Priority;
-         Element            :    out Element_Type);
+        (Minimum_Priority   :        Queue_Priority;
+         Element            :    out Queue_Interfaces.Element_Type);
+
+      function Current_Use return Count_Type;
+      function Peak_Use return Count_Type;
 
    private
       -- not specified by the language
@@ -225,34 +230,35 @@
    -- not specified by the language
 end Ada.Containers.Unbounded_Priority_Queues;
 
-The type Queue is used to represent task-safe priority queues. The type Queue
-needs finalization (see 7.6).
+The type Queue is used to represent task-safe priority queues.
 
 The capacity for instances of type Queue is unbounded.
 
-Two elements E1 and E2 are equivalent if Get_Priority(E1) < Get_Priority(E2) and
-Get_Priority(E2) < Get_Priority(E1) both return False.
+Two elements E1 and E2 are equivalent if Before(Get_Priority(E1),
+Get_Priority(E2)) and Before(Get_Priority(E2), Get_Priority(E1)) both return
+False.
 
-Enqueue inserts an item according to the order specified by the "<" function on
-the result of Get_Priority on the elements. If the queue already contains
+Enqueue inserts an item according to the order specified by the Before function
+on the result of Get_Priority on the elements. If the queue already contains
 elements equivalent to New_Item, then it is inserted after the existing
 equivalent elements.
 
-AARM Ramification: Enqueue never blocks; if more storage is
-needed for a new element, it is allocated dynamically.
+AARM Ramification: Enqueue never blocks; if more storage is needed for a new
+element, it is allocated dynamically.  We don't need to explicitly specify that
+Queue needs finalization, because it is visibly protected.
 
-Dequeue_Only_High_Priority is the same as Dequeue, except that it blocks until
-the element E at the head of the queue satisfies not (Get_Priority(E) <
-Minimum_Priority).
+Dequeue_Only_High_Priority is the same as Dequeue, except that it
+blocks until the element E at the head of the queue satisfies
+Before(Get_Priority(E), Minimum_Priority).
 
-The actual functions for Get_Priority and "<" are expected to return the same
-value each time they are called with the same actuals, and should not modify
-their actuals.  "<" should define a strict weak ordering relationship (see
-A.18). If the actual functions behave in some other manner, the behavior of
-Unbounded_Priority_Queues is unspecified.
+The actual functions for Get_Priority and Before are expected to return the
+same value each time they are called with the same actuals, and should not
+modify their actuals.  Before should define a strict weak ordering relationship
+(see A.18). If the actual functions behave in some other manner, the behavior
+of Unbounded_Priority_Queues is unspecified.
 
 
-A.18.27  Containers.Bounded_Priority_Queues
+A.18.31  Containers.Bounded_Priority_Queues
 
 Static Semantics
 
@@ -266,8 +272,8 @@
    with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>);
    type Queue_Priority is private;
    with function Get_Priority
-     (Element: Queues.Element_Type) return Queue_Priority is <>;
-   with function "<"
+     (Element: Queue_Interfaces.Element_Type) return Queue_Priority is <>;
+   with function Before
      (Left, Right : Queue_Priority) return Boolean is <>;
    Default_Capacity : Count_Type;
    Default_Ceiling: System.Any_Priority := System.Priority'Last;
@@ -280,13 +286,15 @@
          new Queue_Interfaces.Queue with
       pragma Priority(Ceiling);
 
-      entry Enqueue(Container: in out Queue; New_Item: Element_Type);
-      entry Dequeue(Container: in out Queue; Element: out Element_Type);
+      entry Enqueue(New_Item: Queue_Interfaces.Element_Type);
+      entry Dequeue(Element: out Queue_Interfaces.Element_Type);
 
       entry Dequeue_Only_High_Priority
-        (Container          : in out Queue;
-         Minimum_Priority   :        Queue_Priority;
-         Element            :    out Element_Type);
+        (Minimum_Priority   :        Queue_Priority;
+         Element            :    out Queue_Interfaces.Element_Type);
+
+      function Current_Use return Count_Type;
+      function Peak_Use return Count_Type;
 
    private
       -- not specified by the language
@@ -298,9 +306,6 @@
 
 The semantics are the same as for Unbounded_Priority_Queues, except:
 
-    - The type Queue needs finalization (see 7.6) if and only if Element_Type
-      needs finalization.
-
     - The capacity for instances of type Queue is bounded and specified by the
       discriminant Capacity.
 
@@ -312,7 +317,7 @@
 Bounded priority queue objects should be implemented without implicit
 pointers or dynamic allocation.
 
-A.18.28  Indefinite Synchronized Queues
+A.18.32  Indefinite Synchronized Queues
 
 There are three generic packages
 Containers.Indefinite_Synchronized_Queue_Interfaces,
@@ -352,7 +357,7 @@
    end Widgets;
 
    package Widget_Queue_Types is
-     new Ada.Containers.Synchronized_Queues (Widgets.Widget);
+     new Ada.Containers.Synchronized_Queue_Interfaces (Widgets.Widget);
 
    -- Now we design an algorithm around our interface.  Here
    -- we have a set of assembly lines that fabricate widgets,
@@ -1290,7 +1295,7 @@
 ****************************************************************
 
 From: Randy Brukardt
-Date: Monday, May 10, 2010  10:40 PM
+Date: Wednesday, May 19, 2010  10:40 PM
 
 ...
 > I also tried to remove some duplicated verbiage.  For example, the
@@ -1310,7 +1315,7 @@
 ****************************************************************
 
 From: Randy Brukardt
-Date: Monday, May 10, 2010  10:53 PM
+Date: Wednesday, May 19, 2010  10:53 PM
 
 ...
 > The generic library package
@@ -1358,6 +1363,135 @@
 
 I've made these changes (and Tucker's suggestion) in a separate version (so we
 can recover yours if necessary). [This is version /07 - Editor.]
+
+****************************************************************
+
+From: Bob Duff
+Date: Thursday, May 20, 2010  7:15 AM
+
+> It took me forever to understand this; I finally realized that the
+> English wording makes no sense because you actually meant:
+>
+>    with function "<"
+>      (Left, Right : Queue_Priority) return Boolean is <>;
+
+Right, sorry about that.
+
+> ...
+> > Enqueue inserts an item according to the order specified by the "<"
+> > function.
+> > If the queue already contains elements equivalent to New_Item, then
+> > it is inserted after the existing equivalent elements.
+>
+> I don't think this quite works. I think you need to mention
+> Get_Priority somewhere. Maybe:
+>
+> Enqueue inserts an item according to the order specified by the "<"
+> function on the result of Get_Priority on the elements.
+
+Seems slightly less readable (albeit more correct), to me.  Can we keep my
+wording, but add "Get_Priority returns the priority (duh)."? Or "...is expected
+to..."?
+
+> I've made these changes (and Tucker's suggestion) in a separate
+> version (so we can recover yours if necessary).
+
+You always make a separate version, right?  It's in CVS...
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Thursday, May 20, 2010  1:52 PM
+
+> You always make a separate version, right?  It's in CVS...
+
+Not always; I make editorial corrections as I find them, which often means while
+I'm loading the file. So the original submission is never saved anywhere. I made
+a special point to do that this time, which is what I meant above.
+
+****************************************************************
+
+From: Martin Dowie
+Date: Friday, May 21, 2010  2:55 AM
+
+Couple of minor points / questions and revision 1.10
+
+The example references "Ada.Containers.Synchronized_Queues" and not
+"Ada.Containers.Synchronized_Queue_Interfaces".
+
+The Enqueue / Dequeue entries all have a "Container: Queue" paramater - but
+"Queue" is the name of the protected type containing these entries. I've had a
+look through the AI's referencing section 3.09 but didn't see anything that
+would make this allowable. I'm not sure it even makes sense - isn't the PT the
+queue?...
+
+In a number of the PTs, e.g.
+"Ada.Containers.Unbounded_Synchronized_Queues", the discriminent takes a default
+- is that allowed now?
+
+Also, for "Element_Type", shouldn't it be "Queue_Interfaces.Element_Type"?
+
+****************************************************************
+
+From: Bob Duff
+Date: Friday, May 21, 2010  1:29 PM
+
+> Couple of minor points / questions and revision 1.10
+>
+> The example references "Ada.Containers.Synchronized_Queues" and not
+> "Ada.Containers.Synchronized_Queue_Interfaces".
+
+Right.
+
+> The Enqueue / Dequeue entries all have a "Container: Queue" paramater
+> - but "Queue" is the name of the protected type containing these entries.
+> I've had a look through the AI's referencing section 3.09 but didn't
+> see anything that would make this allowable. I'm not sure it even
+> makes sense - isn't the PT the queue?...
+
+That's a mistake I made while converting from the old version to the new
+visibly-protected type.  Those parameters should be removed.
+
+We made it visible so the ceiling priority stuff would make sense.
+
+> In a number of the PTs, e.g.
+> "Ada.Containers.Unbounded_Synchronized_Queues", the discriminent takes
+> a default - is that allowed now?
+
+Good point!  I had forgotten that this type is tagged.
+I wonder if we should allow defaulted discriminants on limited types.
+
+> Also, for "Element_Type", shouldn't it be
+> "Queue_Interfaces.Element_Type"?
+
+Yes.
+
+Thanks for your comments.
+
+****************************************************************
+
+From: Bob Duff
+Date: Friday, May 21, 2010  1:35 PM
+
+Randy, are you going to fix the editorial issues pointed out recently by Martin
+Dowie?
+
+Here's another one:
+
+There is one reference to Queues.Element_Type, and several to Element_Type,
+which should all be Queue_Interfaces.Element_Type.
+
+The defaulted discriminants issue is substantive -- we need to discuss that.
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Saturday, June 12, 2010  11:39 PM
+
+I just did that after I realized that you hadn't in your version of June 7th. I
+also noticed that the abstract functions Current_Use and Peak_Use were never
+defined in any of the concrete versions. I'd expect any decent Ada compiler to
+throw up on that, so I fixed that too.
 
 ****************************************************************
 

Questions? Ask the ACAA Technical Agent