CVS difference for ai05s/ai05-0023-1.txt
--- ai05s/ai05-0023-1.txt 2007/05/05 01:39:14 1.4
+++ ai05s/ai05-0023-1.txt 2008/02/05 04:03:13 1.5
@@ -1,4 +1,6 @@
-!standard 13.13.2(9/2) 07-04-19 AI05-0023-1/03
+!standard 13.13.2(9/2) 08-02-03 AI05-0023-1/04
+!standard 13.13.2(27/2)
+!standard 13.13.2(38)
!class binding interpretation 06-11-13
!status work item 06-11-13
!status received 06-06-27
@@ -51,43 +53,43 @@
Item. S'Read then creates an object of type T constrained by these
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
+ non-discriminant component of Item is 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:
- S'Input then creates an object...
-with:
- S'Input then creates an object of type T...
+Modify 13.13.2(27/2) as follows:
+ S'Output then calls S'Write to write the value of Item to the
+ stream. S'Input then creates an object {of type T} (with the bounds
+ or {(when without defaults) the} discriminants, if any, taken from
+ the stream), passes it to S'Read, and returns the value of the
+ object. {If T has discriminants, then this object is unconstrained
+ if and only the discriminants have defaults.} Normal default
+ initialization and finalization take place for this object (see
+ 3.3.1, 7.6, and 7.6.1).
-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).
-
Add after 13.13.2(38):
Implementation Permissions
If T is a discriminated type and its discriminants have defaults then
in some cases an execution of the default implementation of S'Read is
- not required to create an object of type T. The discriminant values that
- are read in may be checked against the corresponding discriminant values
- of Item. If they are equal, then no object of type T need be created and
- Item may be used instead. If they are not equal and Item is a
- constrained variable, then Constraint_Error may be raised at that point,
- before any further values are read from the stream and before the object
- of type T is created.
+ not required to create an anonymous object of type T. The discriminant
+ values that are read in may be checked against the corresponding
+ discriminant values of Item. If they are equal, then no object of type
+ T need be created and Item may be used instead. If they are not equal and
+ Item is a constrained variable, then Constraint_Error may be raised at
+ that point, before any further values are read from the stream and before
+ the object of type T is created.
- If T is a discriminated type and its discriminants have defaults and if
- an execution of the default implementation of S'Input will, at
- the point of its call to S'Read, execute the default implementation of
- S'Read, then the two executions are allowed to proceed as if
- the discriminants of T did not have defaults. This allows the combined
- executions of S'Input and S'Read to create one object of type T instead
- of two. If this option is exercised, then
+ The default implementation of S'Input that calls the default implementation
+ of S'Read may create a constrained anonymous object with discriminants
+ that match those in the stream.
+
+ AARM NOTE:
+ This allows the combined executions of S'Input and S'Read to create one
+ object of type T instead of two. If this option is exercised, then
- The discriminants are read from the stream by S'Input, not S'Read.
- S'Input declares an object of type T constrained by
the discriminants read from the stream, not an unconstrained object.
@@ -147,13 +149,27 @@
Does the list of assignment operations in 5.2(3) need to be updated? I
think not.
-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?
-
+The proposed changes will reduce the number of times the default S'Read
+needs to create a separate anonymous object. Nevertheless, it will
+still be necessary when the caller provides an unconstrained Item with
+initial discriminant values not matching those in the stream. In this
+case, S'Read will need to create an anonymous object using the
+discriminants read from the stream, and then assign it to the caller-provided
+Item, with all the attendant initialization, adjustment, finalization,
+etc. required if any parts are controlled.
+
+We permit the default implementation of S'Input for a discriminated type
+with defaults to "peek" into the stream to arrange to create an object
+with the proper discriminant values and then pass it off to the default
+implementation of S'Read. Of course the actual implementation may
+effectively "inline" the default implementation of S'Read within S'Input
+to avoid the need for "peeking." If the type has a user-defined
+Initialize routine, then S'Input must call that before passing the
+object to S'Read, and we require that the anonymous object be
+constrained so Initialize can't change the values of the discriminants
+which had been so carefully set up to match those in the stream.
---!corrigendum A.18.2(239/2)
+--!corrigendum 13.13.2(9/2)
!ACATS test
Questions? Ask the ACAA Technical Agent