CVS difference for ai05s/ai05-0069-1.txt
--- ai05s/ai05-0069-1.txt 2007/11/21 05:39:24 1.2
+++ ai05s/ai05-0069-1.txt 2007/12/13 04:39:37 1.3
@@ -1,4 +1,4 @@
-!standard A.18.17(0) 07-11-20 AI05-0069-1/02
+!standard A.18.17(0) 07-11-26 AI05-0069-1/03
!class Amendment 07-10-24
!status ARG Approved 9-0-0 06-11-10
!status work item 07-10-24
@@ -112,7 +112,7 @@
Static Semantics
-The generic library package Containers.Holders has the following declaration:
+The generic library package Containers.Indefinite_Holders has the following declaration:
generic
type Element_Type (<>) is private;
@@ -199,8 +199,9 @@
AARM Implementation Note: This wording describes the canonical semantics.
However, the order and number of calls on the formal equality function
- is unspecified, so an implementation can call it as many or as few times
- as it needs to get the correct answer.
+ is unspecified, so an implementation does not need to call so an
+ implementation need not call the equality function if the correct answer
+ can be determined without doing so.
function To_Holder (New_Item : Element_Type) return Holder;
@@ -894,6 +895,120 @@
(I hope). The rest of the AI is essentially unchanged.
[Editor's note: This is from version /02 of the AI, not repeated here.]
+
+****************************************************************
+
+From: Robert I. Eachus
+Date: Wednesday, November 21, 2007 8:13 AM
+
+The wording Randy sent says:
+
+If Left and Right denote the same holder object, then the function returns True.
+Otherwise, it compares the element contained in Left to the element contained in
+Right using the generic formal equality operator, returning the result of that
+operation. Any exception raised during the evaluation of element equality is propagated.
+
+ AARM Implementation Note: This wording describes the canonical semantics.
+ However, the order and number of calls on the formal equality function
+ is unspecified, so an implementation can call it as many or as few times
+ as it needs to get the correct answer.
+
+There is stilll a bit of we all know what is meant left in the definition of
+Empty_Holder and "=" for the Holder type. We "know" that Holder is an access type,
+and that Empty_Holder returns null--or that that is the intended semantics even
+if someone provides an implementation using a file or database to provide
+persistant semantics. The intended semantics is, I am sure:
+
+function "=" (Left, Right: Holder) return Boolean is
+begin
+ if Is_Empty(Left) then return Is_Empty(Right);
+ else return Left.all = Right.all;
+ end if;
+end "=";
+
+But if this is the intended definition, why not just say so? Note that even
+if the implementation does not choose to make Holder an access type, that this
+definition is correct. There is a "better" definition, but it requires a kludge.
+ If type Holder is defined (in the private part) as:
+
+type Hidden is access Element_Type;
+type Holder is new Hidden;
+
+then you can use this definition:
+
+function "=" (Left, Right: Holder) return Boolean is
+begin
+ if Hidden(Left) = Hidden(Right) then return True;
+ elsif Is_Empty(Left) then return Is_Empty(Right);
+ else return Left.all = Right.all;
+ end if;
+end "=";
+
+Is there a point to all this? Sure. I really don't like the phrase
+"can call it as many or as few times as it needs to get the correct answer" above.
+We know that any implementation that calls what may be a deep comparison more than
+once is just bad code. Zero and one are right answers, and the two examples given
+show that there are variations that call the formal "=" more or less often, but never
+more than once per call. I'd be satisfied with a change to:
+
+ AARM Implementation Note: This wording describes the canonical semantics.
+ The circumstances where the equality operator for Holder calls the formal equality function,
+ and with which parameters, are unspecified.
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Monday, November 26, 2007 8:56 PM
+
+...
+> Is there a point to all this? Sure.
+
+I *was* beginning to wonder. ;-)
+
+> I really don't like the phrase "can call it as many or as few times as it needs
+> to get the correct answer" above.
+
+That wording is just copied from the other containers. We want this one to be
+as little different as possible...
+
+> We know that any implementation that calls
+> what may be a deep comparison more than once is just bad code. Zero and one are
+> right answers, and the two examples given show that there are variations that
+> call the formal "=" more or less often, but never more than once per call.
+
+There is nothing in the language or its definition to prevent bad code. And
+"unspecified" here means what it says; an implementation which calls "=" 47
+times is still correct vis-a-vis the standard. OTOH, I can see your point that
+the note seems to encourage a bad implementation (although I can't quite see
+what purpose an implementor would have with such an implementation).
+
+> I'd be
+> satisfied with a change to:
+>
+>
+> AARM Implementation Note: This wording describes the canonical semantics.
+> The circumstances where the equality operator for Holder calls the formal
+> equality function, and with which parameters, are unspecified.
+
+That just repeats the language definition, which is rarely worthwhile for
+an AARM note. How about saying instead:
+
+ AARM Implementation Note: This wording describes the canonical semantics.
+ However, the order and number of calls on the formal equality function
+ is unspecified, so an implementation does not need to call it if the
+ implementation can determine the correct answer without doing so.
+
+Meaning that we don't talk about the possibility of making extra
+(unnecessary) calls, even though that is allowed.
+
+****************************************************************
+
+From: Robert I. Eachus
+Date: Tuesday, November 27, 2007 4:21 PM
+
+That's fine. I would probably say "so an implementation need not call
+the equality function if the answer can be determined without doing
+so." But that's just wordsmithing.
****************************************************************
Questions? Ask the ACAA Technical Agent