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

Differences between 1.5 and version 1.6
Log of other versions for file ai05s/ai05-0023-1.txt

--- ai05s/ai05-0023-1.txt	2008/02/05 04:03:13	1.5
+++ ai05s/ai05-0023-1.txt	2008/03/07 06:15:18	1.6
@@ -1,13 +1,15 @@
-!standard 13.13.2(9/2)                                   08-02-03    AI05-0023-1/04
+!standard 13.13.2(9/2)                                   08-02-21    AI05-0023-1/05
 !standard 13.13.2(27/2)
-!standard 13.13.2(38)
+!standard 13.13.2(56/2)
 !class binding interpretation 06-11-13
+!status ARG Approved  7-0-2  08-02-08
 !status work item 06-11-13
 !status received 06-06-27
 !priority Medium
 !difficulty Hard
 !qualifier Omission
 !subject 'Read on records with variant parts
+
 !summary
 
 Compilers should not violate the finalization rules when creating 'Read.
@@ -15,7 +17,7 @@
 !question
 
 AI-195 and the section on 'Read seems to have a small hole in it when
-it comes to discriminant records with default discriminants and
+it comes to discriminated records with default discriminants and
 variant parts.
 
 Consider for example:
@@ -42,7 +44,7 @@
 
 !recommendation
 
-(See Summary.)
+(See summary.)
 
 !wording
 
@@ -60,36 +62,35 @@
 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
+    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
+    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). 
 
 
-Add after 13.13.2(38):
+Add after 13.13.2(56/2):
 
          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 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.
+    in two cases an execution of the default implementation of S'Read is
+    not required to create an anonymous object of type T: If the discriminants
+    values that are read in are equal to the corresponding discriminant values
+    of Item, 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.
     
-    The default implementation of S'Input that calls the default implementation
+    A 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: 
+ AARM Implementation 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
+    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.
@@ -168,12 +169,83 @@
 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 13.13.2(9/2)
 
---!corrigendum 13.13.2(9/2)
+@dinsa
+For elementary types, Read reads (and Write writes) the number of stream
+elements implied by the Stream_Size for the type @i<T>; the representation of
+those stream elements is implementation defined.
+For composite types, the Write or Read attribute for
+each component is called in canonical order, which is last dimension varying
+fastest for an array, and positional aggregate order for a record. Bounds are
+not included in the stream if @i<T> is an array type. If @i<T> is a
+discriminated type, discriminants are included only if they have defaults.
+If @i<T> is a tagged type, the tag is not included. For type extensions, the
+Write or Read attribute for the parent type is called, followed by the Write
+or Read attribute of each component of the extension part, in canonical order.
+For a limited type extension, if the attribute of the parent type or any
+progenitor type of @i<T> is available anywhere within the immediate scope of
+@i<T>, and the attribute of the parent type or the type of any of the extension
+components is not available at the freezing point of @i<T>, then the attribute
+of @i<T> shall be directly specified.
+@dinst
+If @i<T> is a discriminated type and its discriminants have defaults then
+S'Read first reads the discriminants from the stream without modifying
+@i<Item>. S'Read then creates an object of type @i<T> constrained by these
+discriminants. The value of this object is then converted to the subtype
+of @i<Item> and is assigned to @i<Item>. Finally, the Read attribute for each
+non-discriminant component of @i<Item> is called in canonical
+order as described above. Normal default initialization and finalization
+take place for the created object.   
+    
+!corrigendum 13.13.2(27/2)
 
+@drepl
+@xbullet<S'Output then calls S'Write to write the value of @i<Item> to the
+stream. S'Input then creates an object (with the bounds
+or discriminants, if any, taken from the stream), passes it to S'Read,
+and returns the value of the object. Normal default
+initialization and finalization take place for this object (see
+3.3.1, 7.6, and 7.6.1).>
+@dby
+@xbullet<S'Output then calls S'Write to write the value of @i<Item> to the
+stream. S'Input then creates an object of type @i<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 @i<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).>
+
+!corrigendum 13.13.2(56/2)
+
+@dinsa
+The number of calls performed by the predefined implementation of the stream-oriented
+attributes on the Read and Write operations of the stream type is unspecified. An
+implementation may take advantage of this permission to perform internal buffering.
+However, all the calls on the Read and Write operations of the stream type needed to
+implement an explicit invocation of a stream-oriented attribute must take place before
+this invocation returns. An explicit invocation is one appearing explicitly in the
+program text, possibly through a generic instantiation (see 12.3). 
+@dinss
+If @i<T> is a discriminated type and its discriminants have defaults then
+in two cases an execution of the default implementation of S'Read is
+not required to create an anonymous object of type @i<T>: If the discriminants
+values that are read in are equal to the corresponding discriminant values
+of @i<Item>, then no object of type @i<T> need be created and @i<Item> may be used
+instead. If they are not equal and @i<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 @i<T> is created.
+    
+A 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. 
 
 !ACATS test
 
+Add an ACATS C-Test to check the proper operation of examples like the one in the
+question, taking care to respect the implementation permissions.
 
 !appendix
 

Questions? Ask the ACAA Technical Agent