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

Differences between 1.2 and version 1.3
Log of other versions for file ai05s/ai05-0257-1.txt

--- ai05s/ai05-0257-1.txt	2011/06/20 04:55:19	1.2
+++ ai05s/ai05-0257-1.txt	2011/07/29 02:21:00	1.3
@@ -1,8 +1,9 @@
-!standard A.18.2(167/2)                             11-06-16    AI05-0257-1/01
-!standard A.18.3(92/2)
+!standard A.18.3(92/2)                             11-07-28    AI05-0257-1/02
 !standard A.18.3(94/2)
 !standard A.18.10(0)
-!class Amendment 11-06-16
+!class binding interpretation 11-06-16
+!status Amendment 2012 11-07-28
+!status ARG Approved 12-0-0  11-06-25
 !status work item 11-06-16
 !status received 11-04-13
 !priority Low
@@ -10,8 +11,11 @@
 !subject Insert returning a Position
 !summary
 
-!proposal
+If Count = 0 for a container Insert subprogram that has a Position parameter,
+the Position parameter is set to the value of the Before parameter by the call.
 
+!question
+
 A.18.3(92/2), A.18.10(143/3), and A.18.10(145/3) say
 "Position designates the first newly-inserted node." What happens if
 Count = 0 and there are no newly-inserted nodes??
@@ -19,25 +23,92 @@
 A.18.3(94/2) doesn't say anything at all about the value of Position. That's
 clearly wrong.
 
+!recommendation
+
+(See Summary.)
+
 !wording
 
+Add an AARM Ramification after A.18.2(162/2):
+
+If Count equals 0, Position will designate the element designated by Before,
+rather than a newly inserted element. Otherwise, Position will designate the
+first newly inserted element.
+
+Modify part of A.18.3(92/2), A.18.10(143/3), and A.18.10(145/3):
+
+Position designates the first newly-inserted element{, or if Count equals 0,
+then Position is assigned the value of Before}.
+
+Add to A.18.3(94/2):
+
+Position designates the first newly-inserted element, or if Count equals 0,
+then Position is assigned the value of Before.
+
+Remove AARM note A.18.10(143.a/3).
+
 !discussion
 
 A.18.2(167/2) doesn't explicitly address this question, but since it is
 defined in terms of indexes, it effectively returns the insertion position when
-Count = 0.
+Count = 0. The description of the other routines is more likely to be what
+the caller expects (in that following operations are likely to treat Position
+as a new node).
+
+Removing the Count parameter altogether from the Insert routines that return
+a Position would be the best solution (it is much less error-prone). A code survey
+shows that virtually every use of this call uses Count = 1, either by default or
+explicitly. Still, that is considered too incompatible for about 2/3rds of the
+ARG members.
+
+Thus we defined Position to equal Before when Count equals 0.
+
+Any other solution would either make the vector case inconsistent in behavior with
+other containers, or potentially change the behavior of existing programs without any
+indication of a change (there probably are no such programs, but no one likes the
+"probably" in that statement).
+
+!corrigendum A.18.3(92/2)
+
+@drepl
+@xindent<If Before is not No_Element, and does not designate an element in Container,
+then Program_Error is propagated. Otherwise, Insert allocates Count copies of New_Item,
+and inserts them prior to the element designated by Before. If Before equals No_Element,
+the new elements are inserted after the last element (if any). Position designates
+the first newly-inserted element. Any exception raised during allocation of internal
+storage is propagated, and Container is not modified.>
+@dby
+@xindent<If Before is not No_Element, and does not designate an element in Container,
+then Program_Error is propagated. Otherwise, Insert allocates Count copies of New_Item,
+and inserts them prior to the element designated by Before. If Before equals No_Element,
+the new elements are inserted after the last element (if any). Position designates
+the first newly-inserted element, or if Count equals 0, then Position is assigned
+the value of Before. Any exception raised during allocation of internal
+storage is propagated, and Container is not modified.>
+
+!corrigendum A.18.3(94/2)
+
+@drepl
+@xindent<If Before is not No_Element, and does not designate an element in Container,
+then Program_Error is propagated. Otherwise, Insert inserts Count new elements prior to
+the element designated by Before. If Before equals No_Element, the new elements are
+inserted after the last node (if any). The new elements are initialized by default
+(see 3.3.1). Any exception raised during allocation of internal storage is propagated,
+and Container is not modified.>
+@dby
+@xindent<If Before is not No_Element, and does not designate an element in Container,
+then Program_Error is propagated. Otherwise, Insert inserts Count new elements prior to
+the element designated by Before. If Before equals No_Element, the new elements are
+inserted after the last node (if any). The new elements are initialized by default
+(see 3.3.1). Position designates the first newly-inserted element, or if Count
+equals 0, then Position is assigned the value of Before. Any exception raised during
+allocation of internal storage is propagated, and Container is not modified.>
+
+!corrigendum A.18.10(0)
+
+@dinsc
 
-This result seems broken, in that it almost never is what you would want.
-The description of the other routines is more likely to be correct (in that
-following operations are likely to treat Position as a new node).
-Indeed, Count /= 1 almost never makes sense when returning a position. As such,
-one possibility would be simply to raise Program_Error if Count = 0 when
-returning a position (as there is no newly inserted node).
-
-Removing the Count parameter altogether from Inserts returning Positions
-would be the best solution (it much less error-prone), but that might be
-too incompatible (even though the vast majority of code that use the parameter
-would simply need to remove Count => 1, from the calls).
+Force a conflict; real text found in the conflict file.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent