CVS difference for ais/ai-00195.txt

Differences between 1.25 and version 1.26
Log of other versions for file ais/ai-00195.txt

--- ais/ai-00195.txt	2002/06/14 23:48:55	1.25
+++ ais/ai-00195.txt	2002/10/01 03:08:53	1.26
@@ -1,4 +1,4 @@
-!standard 8.3 (23)                                    02-05-09  AI95-00195/11
+!standard 8.3 (23)                                    02-09-24  AI95-00195/12
 !standard 13.13.1 (09)
 !standard 13.13.1 (27)
 !standard 13.13.1 (35)
@@ -29,8 +29,8 @@
 available, even if it is not specified. Similarly, if Write is available then
 T'Output is available. T'Class'Read, T'Class'Write, T'Class'Input and
 T'Class'Output are available only if they are specified or the corresponding
-specific attribute is available everywhere within the immediate
-scope of T.
+specific attribute is available somewhere within the same list of declarations
+as T.
 
 4 - In the profiles of the stream-oriented attributes, the notation
 "italicized T" refers to the base subtype for a scalar type, and to the first
@@ -333,7 +333,18 @@
 then if T2'Read raises an exception when reading component C2, it is
 unspecified if C1 is modified or not.
 
+Similarly, 13.13.2(35) describes what checks must/may be performed on
+components of a scalar of access types, but doesn't specify at which point
+these checks take place.  This could make an observable difference: for
+example, one implementation may check each discriminant as it reads it;
+another might read all the discriminants and then check them all before
+reading any other component; a third may attempt to read all the fields in
+the record (or at least all the fields that don't depend on a
+discriminant) before checking any of the discriminants.  Clearly we want to
+leave such implementation details unspecified, as overconstraining
+implementations could have negative effects, notably in terms of performance.
 
+
 7 - When the type has defaulted discriminants, the predefined Read attribute
 must read them from the stream. It can be the case that the actual object
 passed to Read is constrained. In this case, the discriminants found in the
@@ -452,6 +463,11 @@
 equal to those of the actual parameter. Constraint_Error is raised if this
 check fails.
 
+It is unspecified at which point and in which order these checks are performed.
+In particular, if Constraint_Error is raised due to the failure of one of these
+checks, it is unspecified how many stream elements have been read from the
+stream.
+
 !corrigendum 13.13.2(36/1)
 
 @drepl
@@ -489,12 +505,12 @@
 A stream-oriented attribute for a subtype of a class-wide type T'Class is
 available at places where one of the following conditions is true:
 @xbullet<@i<T> is nonlimited; or>
-@xbullet<@i<T> or its partial view is declared in the visible part of a
-(generic) package, and the corresponding attribute of @i<T> is available
-somewhere within the visible part of the package; or>
-@xbullet<@i<T> or its partial view is declared somewhere other than the
-visible part of a (generic) package, and the corresponding attribute of @i<T>
-is available somewhere within the immediate scope of @i<T>; or
+@xbullet<@i<T> has a partial view, and the corresponding attribute of @i<T> is
+available somewhere within the visible part of the (generic) package where
+@i<T> is declared; or
+@xbullet<@i<T> has no partial view and the corresponding attribute of @i<T>
+is available somewhere within the list of @fa<declarative_items> where T is
+declared; or
 @xbullet<The attribute has been specified via an
 @fa<attribute_definition_clause>, and the @fa<attribute_definition_clause>
 is visible.>
@@ -1221,6 +1237,58 @@
 Sorry about writing all of this, but it seems necessary for me to figure out
 what this all means. And I hate the throw it away afterwards, hoping it will
 help someone else figure it out.
+
+****************************************************************
+
+!topic Exceptions raised by 'Read, 'Input
+!reference RM95-13.13.2(26,35)
+!from Adam Beneschan 06-27-02
+!discussion
+
+RM95 13.13.2(35) says that the default implementations of 'Read and
+'Input make sure that discriminants and components with
+default_expressions read from the stream belong to their subtypes, and
+raise Constraint_Error if the check fails.  However, there is no
+definition of *when* this check is raised.
+
+RM95 13.13.2(26) says that the default implementation of 'Input on an
+array type reads the bounds first.  Although this is not explicit, I
+assume that Constraint_Error should be raised if any bound range read
+from the stream is not compatible with the array index subtype.
+Again, there is no definition of when this check should be raised.
+
+Since the default 'Read and 'Input are defined in terms of doing a
+sequence of 'Reads on other components or bounds, it makes a
+difference when the checks are performed.  For example, conceivably
+one implementation may check each discriminant as it reads it, and
+raise Constraint_Error immediately; another might read all the
+discriminants and then check all the discriminants before reading any
+other component; a third may attempt to read all the fields in the
+record (or at least all the fields that don't depend on a
+discriminant) before checking any of the discriminants.  The effect on
+the stream being read from will probably be different in all three
+cases (e.g. the file position will be different if the stream is in a
+file).
+
+Question: Does the language define, or put any limitations on, the
+point at which the exception may be raised (in terms of what values
+have been read from the stream)?  Or is this completely left up to the
+implementor?  In the discriminant record example in my previous
+paragraph, are all three implementations correct?
+
+****************************************************************
+
+From: Pascal Leroy
+Sent: Monday, July 8, 2002  5:11 AM
+
+> Question: Does the language define, or put any limitations on, the
+> point at which the exception may be raised (in terms of what values
+> have been read from the stream)?  Or is this completely left up to the
+> implementor?  In the discriminant record example in my previous
+> paragraph, are all three implementations correct?
+
+It seems to me that this should be left unspecified, but I agree that it
+would be worth a clarification.  Perhaps this could be added to AI 195...
 
 ****************************************************************
 

Questions? Ask the ACAA Technical Agent