Version 1.2 of ai12s/ai12-0391-1.txt

Unformatted version of ai12s/ai12-0391-1.txt version 1.2
Other versions for file ai12s/ai12-0391-1.txt

!standard A.18.3(6/5)          20-09-10 AI12-0391-1/02
!standard A.18.3(23/5)
!standard A.18.3(50.2/5)
!standard A.18.3(96/5)
!class Amendment 20-08-31
!status Amendment 1-2012 20-09-10
!status ARG Approved 8-0-6 20-09-09
!status work item 20-08-31
!status received 20-06-16
!priority Low
!difficulty Easy
!subject List containers need Append_One
!summary
Add an Append_One operation to Ada.Containers.Doubly_Linked_Lists, and use it for Add_Unnamed in the Aggregate aspect.
!problem
The Aggregate aspect for Ada.Containers.Doubly_Linked_Lists has Add_Unnamed defined to be the existing Append operation. However, the existing Append operation includes a Count parameter which does not meet the profile of the required operation. Fix this? (Yes.)
!proposal
(See Summary.)
!wording
In A.18.3(6/5) and A.18.3(50.2/5), replace "Append" with "Append_One".
Add after A.18.3(23/5):
procedure Append_One (Container : in out List; New_Item : in Element_Type) with Pre => (not Tampering_With_Cursors_Prohibited (Container) or else raise Program_Error) and then (Length (Container) <= Count_Type'Last - 1 or else raise Constraint_Error), Post => Length (Container)'Old + 1 = Length (Container);
Add after A.18.3(96/5):
procedure Append_One (Container : in out List; New_Item : in Element_Type) with Pre => (not Tampering_With_Cursors_Prohibited (Container) or else raise Program_Error) and then (Length (Container) <= Count_Type'Last - 1 or else raise Constraint_Error), Post => Length (Container)'Old + 1 = Length (Container);
Equivalent to Insert (Container, No_Element, New_Item, 1).
!discussion
As in Vectors, this operation cannot be named Append, as any call to Append without the Count parameter would be ambiguous if that was the case.
!corrigendum A.18.3(6/5)
Replace the paragraph:
type List is tagged private with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type, Iterator_View => Stable.List, Aggregate => (Empty => Empty, Add_Unnamed => Append), Stable_Properties => (Length, Tampering_With_Cursors_Prohibited, Tampering_With_Elements_Prohibited), Default_Initial_Condition => Length (List) = 0 and then (not Tampering_With_Cursors_Prohibited (List)) and then (not Tampering_With_Elements_Prohibited (List)); pragma Preelaborable_Initialization(List);
by:
type List is tagged private with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, Iterator_Element => Element_Type, Iterator_View => Stable.List, Aggregate => (Empty => Empty, Add_Unnamed => Append_One), Stable_Properties => (Length, Tampering_With_Cursors_Prohibited, Tampering_With_Elements_Prohibited), Default_Initial_Condition => Length (List) = 0 and then (not Tampering_With_Cursors_Prohibited (List)) and then (not Tampering_With_Elements_Prohibited (List)); pragma Preelaborable_Initialization(List);
!corrigendum A.18.3(23/5)
Insert after the paragraph:
procedure Append (Container : in out List; New_Item : in Element_Type; Count : in Count_Type := 1) with Pre => (not Tampering_With_Cursors_Prohibited (Container) or else raise Program_Error) and then (Length (Container) <= Count_Type'Last - Count or else raise Constraint_Error), Post => Length (Container)'Old + Count = Length (Container);
the new paragraph:
procedure Append_One (Container : in out List; New_Item : in Element_Type) with Pre => (not Tampering_With_Cursors_Prohibited (Container) or else raise Program_Error) and then (Length (Container) <= Count_Type'Last - 1 or else raise Constraint_Error), Post => Length (Container)'Old + 1 = Length (Container);
!comment A.18.3(50.2/5) not in corrigendum text.
!comment A.18.3(96/5) not in corrigendum text.
!ASIS
No ACATS effect.
!ACATS test
An ACATS C-Test is needed to check that the new procedure exists and works as expected. (This is a low priority test, as container aggregates will use the procedure, and thus the aggregate tests will check this functionality indirectly.)
!appendix

From: Ed Schonberg
Sent: Tuesday, June 16, 2020  3:29 PM

The modification to Ada/Containers.Doubly_Linked_Lists (A.18.3) indicates that 
the aspect Aggregate uses the existing Append operation fort Add_Unnamed. 
However the existing Append operation includes a Count parameter which does 
not meet the profile of the required operation.  An operation Append_One should 
be mentioned, as is already done for the Vector container.

****************************************************************

From: Tucker Taft
Sent: Tuesday, June 16, 2020  3:38 PM

Good point!

****************************************************************


Questions? Ask the ACAA Technical Agent