CVS difference for ai12s/ai12-0212-1.txt
--- ai12s/ai12-0212-1.txt 2019/02/07 06:31:30 1.24
+++ ai12s/ai12-0212-1.txt 2019/02/14 05:24:39 1.25
@@ -1,4 +1,4 @@
-!standard 4.3.5(0) 19-01-27 AI12-0212-1/10
+!standard 4.3.5(0) 19-02-13 AI12-0212-1/11
!standard 1.1.4(12)
!standard 1.1.4(13)
!standard 2.1(15)
@@ -23,6 +23,15 @@
!standard 11.2(3)
!standard 13.1.1(5/3)
!standard 13.1.1(7/3)
+!standard A.18.2(8/3)
+!standard A.18.2(14/2)
+!standard A.18.2(47/2)
+!standard A.18.2(175/2)
+!standard A.18.3(6/3)
+!standard A.18.5(3/3)
+!standard A.18.6(4/3)
+!standard A.18.8(3/3)
+!standard A.18.9(4/3)
!class Amendment 16-12-27
!status Amendment 1-2012 18-11-19
!status ARG Approved 5-0-2 18-10-21
@@ -941,12 +950,14 @@
-- Need to add these subprograms:
function New_Vector (First, Last : Index_Type) return Vector
- is (To_Vector (Last))
+ is (To_Vector (Count_Type (Last - First + 1)))
with Pre => First = Index_Type'First;
procedure Append_One (Container : in out Vector;
New_Item : in Element_Type);
+ Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, 1).
+
A.18.3 The Generic Package Containers.Doubly_Linked_Lists
Add the Aggregate aspect to the existing ones on type List:
@@ -1274,13 +1285,13 @@
!corrigendum 4.3.3(27)
@drepl
-For a @fa<named_array_aggregate> without an @b<others> choice, the bounds are
-determined by the smallest and largest index values covered by any
-@fa<discrete_choice_list>.
-@dby
-For any other @fa<named_array_aggregate> without an @b<others> choice, the
+@xbullet<For a @fa<named_array_aggregate> without an @b<others> choice, the
bounds are determined by the smallest and largest index values covered by any
-@fa<discrete_choice_list>.
+@fa<discrete_choice_list>.>
+@dby
+@xbullet<For any other @fa<named_array_aggregate> without an @b<others> choice,
+the bounds are determined by the smallest and largest index values covered by
+any @fa<discrete_choice_list>.>
!corrigendum 4.3.3(31)
@@ -1805,6 +1816,155 @@
@fa<aggregate> determined by the identified aspect;>
+!corrigendum A.18.2(8/3)
+
+@drepl
+@xcode< @b<type> Vector @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(Vector);>
+@dby
+@xcode< @b<type> Vector @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_Vector,
+ Add_Unnamed =@> Append_One,
+ New_Indexed =@> New_Vector,
+ Assign_Indexed =@> Replace_Element);
+ @b<pragma> Preelaborable_Initialization(Vector);>
+
+!corrigendum A.18.2(14/2)
+
+@dinsa
+@xcode< @b<function> To_Vector
+ (New_Item : Element_Type;
+ Length : Count_Type) @b<return> Vector;>
+@dinst
+@xcode< @b<function> New_Vector (First, Last : Index_Type) @b<return> Vector @b<is>
+ (To_Vector (Count_Type (Last - First + 1)))
+ @b<with> Pre =@> First = Index_Type'First;>
+
+
+!corrigendum A.18.2(47/2)
+
+@dinsa
+@xcode< @b<procedure> Append (Container : @b<in out> Vector;
+ New_Item : @b<in> Element_Type;
+ Count : @b<in> Count_Type := 1);>
+@dinst
+@xcode< @b<procedure> Append_One (Container : @b<in out> Vector;
+ New_Item : @b<in> Element_Type);>
+
+!corrigendum A.18.2(175/2)
+
+@dinsa
+@xindent<Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, Count).>
+@dinss
+@xcode<@b<procedure> Append_One (Container : @b<in out> Vector;
+ New_Item : @b<in> Element_Type);>
+
+@xindent<Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, 1).>
+
+
+!corrigendum A.18.3(6/3)
+
+@drepl
+@xcode< @b<type> List @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(List);>
+@dby
+@xcode< @b<type> List @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_List,
+ Add_Unnamed =@> Append);
+ @b<pragma> Preelaborable_Initialization(List);>
+
+
+!corrigendum A.18.5(3/2)
+
+@drepl
+@xcode< @b<type> Map @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(Map);>
+@dby
+@xcode< @b<type> Map @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_Map,
+ Add_Named =@> Insert);
+ @b<pragma> Preelaborable_Initialization(Map);>
+
+
+!corrigendum A.18.6(4/3)
+
+@drepl
+@xcode< @b<type> Map @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(Map);>
+@dby
+@xcode< @b<type> Map @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Variable_Indexing =@> Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_Map,
+ Add_Named =@> Insert);
+ @b<pragma> Preelaborable_Initialization(Map);>
+
+
+!corrigendum A.18.8(3/3)
+
+@drepl
+@xcode< @b<type> Set @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(Set);>
+@dby
+@xcode< @b<type> Set @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_Set,
+ Add_Unnamed =@> Include);
+ @b<pragma> Preelaborable_Initialization(Set);>
+
+
+!corrigendum A.18.9(4/3)
+
+@drepl
+@xcode< @b<type> Set @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type;
+ @b<pragma> Preelaborable_Initialization(Set);>
+@dby
+@xcode< @b<type> Set @b<is tagged private>
+ @b<with> Constant_Indexing =@> Constant_Reference,
+ Default_Iterator =@> Iterate,
+ Iterator_Element =@> Element_Type,
+ Aggregate =@> (Empty =@> Empty_Set,
+ Add_Unnamed =@> Include);
+ @b<pragma> Preelaborable_Initialization(Set);>
+
!ASIS
!ACATS test
@@ -5049,5 +5209,83 @@
Agree, better to switch to "the container type" once you get too far from
the original aspect syntax.
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Wednesday, February 13, 2019 10:54 PM
+
+The Vector container part of the wording has the following:
+
+> -- Need to add these subprograms:
+> function New_Vector (First, Last : Index_Type) return Vector
+> is (To_Vector (Last))
+> with Pre => First = Index_Type'First;
+>
+> procedure Append_One (Container : in out Vector;
+> New_Item : in Element_Type);
+
+The second of these has no description whatsoever, and there is no suggestion
+of where one might add these. Gee, thanks, Tuck!
+
+The first subprogram has a description, unfortunately it is nonsense. The
+specification of the one parameter form of To_Vector is:
+
+ function To_Vector (Length : Count_Type) return Vector;
+
+Since Ada is strongly typed, and so far as I know Ada 2020 doesn't change that,
+and Index_Type /= Count_Type, this is garbage. Moreover, this doesn't work if
+Index_Type'First /= 1. For instance, if someone declared:
+ type Goofy is range 278 .. 314;
+the above code would call To_Vector with 314, making a vector with 314
+elements. However, since the type only contains 37 values, that would
+raise Constraint_Error by A.18.2(89.1/3).
+
+Aside: Is there a way to write the maximum number of elements of a vector, in
+terms of Count_Type, without possibly overflowing? Index_Type cannot be
+assumed static. If Index_Type'First < 0, then there can be more elements in
+Index_Type than in Count_Type. (The wording doesn't say so explicitly, but
+since the Capacity is in terms of Count_Type, there can't be more than
+Count_Type'Last elements in a vector.) I need to use this calculation in a
+precondition for To_Vector and other inserting routines.
+
+Something like:
+ function Maximum_Length return Count_Type is
+ (if Index_Type'First >=0 then
+ (if Count_Type'Pos(Count_Type'Last) not in Index_Type then
+ Count_Type'Last
+ else Count_Type (Index_Type'Last - Index_Type'First + 1))
+ elsif ???);
+handles the positive values, but if the type includes negative values, the
+result could overflow. I suppose I could just define the routine and let the
+implementer figure out how to implement it. The obvious solution being:
+ function Maximum_Length return Count_Type is
+ begin
+ return Count_Type (Index_Type'Last - Index_Type'First + 1);
+ exception
+ when Constraint_Error => return Count_Type'Last;
+ end Maximum_Length;
+So all we need is an "expression exception handler". :-) End Aside.
+
+Anyway, New_Vector ought to be something like, inserted after A.18.2(14/2):
+
+ function New_Vector (First, Last : Index_Type) return Vector
+ is (To_Vector (Count_Type (Last - First + 1)))
+ with Pre => First = Index_Type'First;
+
+I'm not sure that we still need the Pre, but it is expected for the intended
+use. I left it until someone (Tuck) tells me to drop it.
+
+For Append_One, this appears to be the same as Append with the defaulted
+parameter removed.
+
+Thus, the description should be:
+
+procedure Append_One (Container : in out Vector;
+ New_Item : in Element_Type);
+
+Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, 1).
+
+And this needs to be inserted after A.18.2(175), with the spec after A.18.2(47/2).
****************************************************************
Questions? Ask the ACAA Technical Agent