CVS difference for ai05s/ai05-0023-1.txt
--- ai05s/ai05-0023-1.txt 2007/04/11 00:57:09 1.3
+++ ai05s/ai05-0023-1.txt 2007/05/05 01:39:14 1.4
@@ -1,4 +1,4 @@
-!standard 13.13.2(9/2) 07-04-05 AI05-0023-1/02
+!standard 13.13.2(9/2) 07-04-19 AI05-0023-1/03
!class binding interpretation 06-11-13
!status work item 06-11-13
!status received 06-06-27
@@ -44,28 +44,30 @@
-Add after 13.13.2(9/2)
+Add after 13.13.2(9/2):
If T is a discriminated type and its discriminants have defaults then
S'Read first reads the discriminants from the stream without modifying
Item. S'Read then creates an object of type T constrained by these
- discriminants. The Read attribute for each non-discriminant component
- of this object (not of Item) is then called in canonical
- order as described above. Finally, the value of this object is
- converted to the subtype of Item and is assigned to Item. Normal default
- initialization and finalization take place for this object.
+ discriminants. The value of this object is then converted to the subtype
+ of Item and is assigned to Item. Finally, the Read attribute for each
+ non-discriminant component of Item is then called in canonical
+ order as described above. Normal default initialization and finalization
+ take place for the created object.
-In 13.13.2(27/2) replace
+In 13.13.2(27/2) replace:
S'Input then creates an object...
S'Input then creates an object of type T...
-Append to the end of 13.13.2(27/2)
+Append to the end of 13.13.2(27/2):
If T has discriminants, then this object is constrained if and only if
- T has discriminants without defaults (that is, if and only if discriminants
- were read from the stream).
+ T has discriminants without defaults (that is, if and only if
+ discriminants were read from the stream).
-Add after 13.13.2(38)
+Add after 13.13.2(38):
@@ -93,23 +95,62 @@
the stream are read from Item instead.
- The permissions of the preceding paragraph then apply and no object
of type T need be created by the execution of S'Read.
-1) When we say that "the value of this object ... is assigned to Item",
- does it need to be explicitly stated that this is an assignment operation?
- Does the list of assignment operations in 5.2(3) need to be updated? I
- think not.
-2) Does it need to be stated more explicitly that the permission to treat a
- type with defaults as though it does not have defaults only applies in
- the case where S'Input calls S'Read and does not apply in the case
- where some other caller calls S'Read?
+ Counter : Natural := 0;
+ function Default_Value return Integer is
+ Text_Io.Put_Line ("F was called"); -- a user-visible side-effect
+ Counter := Counter + 1; -- another side-effect
+ return Counter;
+ end Default_Value;
+ type R (D : Boolean := True) is
+ F : Integer := Default_Value;
+ end record;
+ procedure P (Stream : access Ada.Streams.Root_Stream_Type'Class) is
+ Saved_Counter : constant Natural := Counter;
+ R_Val : constant R := (D => False, F => 123);
+ R'Output (Stream, R_Val);
+ pragma Assert (R_Val = R'Input (Stream);
+ pragma Assert ((Counter - Saved_Counter) in 1 .. 2);
+ procedure Do_Some_Stuff_Including_A_Call_To_P is ... ;
+Without these implementation permissions, the execution of P's call to
+R'Input must include two calls to Default_Value. R'Input would declare
+a local temporary and initialize it; this initialization would include
+one call to Default_Value. R'Input would then call R'Read, which would
+declare a second temporary and initialize it; this initialization would
+include the second call to Default_Value.
+With these implementation permissions, it is permitted to call
+Default_Value only once.
This problem applies to all depends-on-discriminant components with non-trivial
+When we say that "the value of this object ... is assigned to Item",
+does it need to be explicitly stated that this is an assignment operation?
+Does the list of assignment operations in 5.2(3) need to be updated? I
+Does it need to be stated more explicitly that the permission to treat a
+type with defaults as though it does not have defaults only applies in
+the case where S'Input calls S'Read and does not apply in the case
+where some other caller calls S'Read?
Questions? Ask the ACAA Technical Agent