CVS difference for ais/ai-00373.txt

Differences between 1.7 and version 1.8
Log of other versions for file ais/ai-00373.txt

--- ais/ai-00373.txt	2005/02/08 07:12:40	1.7
+++ ais/ai-00373.txt	2005/06/16 23:47:36	1.8
@@ -1,7 +1,12 @@
-!standard 03.03.01(08)                                 05-02-02  AI95-00373/05
+!standard 03.03.01(08)                                 05-05-18  AI95-00373/06
 !standard 03.03.01(18/1)
 !standard 03.03.01(19)
 !standard 03.03.01(20)
+!standard 04.08(07)
+!standard 04.08(08)
+!standard 04.08(10)
+!standard 07.06(10)
+!standard 07.06(11)
 !class binding interpretation 04-02-05
 !status Amendment 200Y 04-12-02
 !status ARG Approved 9-0-1  04-11-21
@@ -20,12 +25,20 @@
 is reduced, but not eliminated, by imposing additional restrictions on the
 order that an implementation may choose.
 
+"Initialized by default" is defined, and it is used to define when
+Initialize is called. (And will be used in other AIs to define the
+initialization of other kinds of objects as well.)
+
 !question
 
 The rules of 3.3.1(20) are too lax -- they allow one to refer to
 uninitialized discriminants, uninitialized access values, etc.
 Was this intended? (No.)
 
+We want Initialize always to be called for an object without an initialization
+expression (other than aggregates), but this is done on a case-by-case basis.
+Wouldn't it be better to do this with a global rule? (Yes.)
+
 !recommendation
 
 (See summary.)
@@ -42,7 +55,8 @@
 Replace 3.3.1(18/1 - 20) with
 
   3. The object is created, and, if there is not an initialization expression,
-  any per-object expressions (see 3.8) are elaborated and any implicit initial
+  the object is *initialized by default*. When an object is initialized by
+  default, any per-object expressions (see 3.8) are elaborated and any implicit initial
   values for the object or for its subcomponents are obtained as determined by
   the nominal subtype. Any initial values (whether explicit or implicit) are
   assigned to the object or to the corresponding subcomponents. As described
@@ -65,6 +79,43 @@
         declarations must precede the initial value evaluations of the
         component occurring later.
 
+Replace 4.8(7-10) with
+
+  For the evaluation of an initialized allocator, the
+  evaluation of the qualified_expression is performed first. An
+  object of the designated type is created and the value of the
+  qualified_expression is converted to the designated subtype
+  and assigned to the object.
+
+  For the evaluation of an uninitialized allocator, the
+  elaboration of the subtype_indication is performed first. Then:
+
+  If the designated type is elementary, an object of the
+  designated subtype is created and any implicit initial value
+  is assigned;
+
+  If the designated type is composite, an object of the
+  designated type is created with tag, if any, determined by
+  the subtype_mark of the subtype_indication. This object is then
+  initialized by default (see 3.3.1) using the subtype_indication
+  as its nominal subtype. A check is made that the value of the
+  object belongs to the designated subtype. Constraint_Error is
+  raised if this check fails. This check and the initialization
+  of the object are performed in an arbitrary order.
+
+
+Replace 7.6(10-11) with
+
+  During the elaboration or evaluation of a construct that causes an object to
+  be initialized by default, for every controlled subcomponent of the object
+  that is not assigned an initial value (as defined in 3.3.1), Initialize is
+  called on that subcomponent. Similarly, if the object that is initialized by
+  default as a whole is controlled, Initialize is called on the object.
+
+  For an extension_aggregate whose ancestor_part is a subtype_mark, if the type
+  of the ancestor part is controlled, the Initialize procedure of the
+  ancestor type is called, unless that Initialize procedure is abstract.
+
 !example
 
   procedure Test is
@@ -195,16 +246,18 @@
 
 @drepl
 @xhang<@xterm<3.>The object is created, and, if there is not an initialization
-expression, any per-object expressions (see 3.8) are elaborated and any
+expression, any per-object constraints (see 3.8) are elaborated and any
 implicit initial values for the object or for its subcomponents are obtained
 as determined by the nominal subtype.>
 @dby
 @xhang<@xterm<3.>The object is created, and, if there is not an initialization
-expression, any per-object expressions (see 3.8) are elaborated and any
-implicit initial values for the object or for its subcomponents are obtained as
-determined by the nominal subtype. Any initial values (whether explicit or
-implicit) are assigned to the object or to the corresponding subcomponents. As
-described in 5.2 and 7.6, Initialize and Adjust procedures can be called.>
+expression, the object is @i<initialized by default>. When an object is
+initialized by default, any per-object constraints (see 3.8) are elaborated and
+any implicit initial values for the object or for its subcomponents are
+obtained as determined by the nominal subtype. Any initial values (whether
+explicit or implicit) are assigned to the object or to the corresponding
+subcomponents. As described in 5.2 and 7.6, Initialize and Adjust procedures
+can be called.>
 
 !corrigendum 3.3.1(19)
 
@@ -231,7 +284,7 @@
 @xbullet<Assignment to any part of the object is preceded
 by the evaluation of the value that is to be assigned.>
 @xbullet<The evaluation of a @fa<default_expression> that includes the name of
-a discriminant is preceded by the assigment to that discriminant.>
+a discriminant is preceded by the assignment to that discriminant.>
 @xbullet<The evaluation of the @fa<default_expression> for any component that
 depends on a discriminant is preceded by the assignment to that
 discriminant.>
@@ -242,6 +295,82 @@
 of the component occurring earlier in the order of the component
 declarations must precede the initial value evaluations of the
 component occurring later.>
+
+!corrigendum 4.8(07)
+
+@drepl
+For the evaluation of an @fa<allocator>, the elaboration of the
+@fa<subtype_indication> or the evaluation of the @fa<qualified_expression> is
+performed first. For the evaluation of an initialized allocator, an object of
+the designated type is created and the value of the @fa<qualified_expression>
+is converted to the designated subtype and assigned to the object.
+@dby
+For the evaluation of an initialized allocator, the
+evaluation of the @fa<qualified_expression> is performed first. An
+object of the designated type is created and the value of the
+@fa<qualified_expression> is converted to the designated subtype
+and assigned to the object.
+
+!corrigendum 4.8(08)
+
+@drepl
+For the evaluation of an uninitialized allocator:
+@dby
+For the evaluation of an uninitialized allocator, the
+elaboration of the @fa<subtype_indication>
+is performed first. Then:
+
+!corrigendum 4.8(10)
+
+@drepl
+@xbullet<If the designated type is composite, an object of the designated type
+is created with tag, if any, determined by the @fa<subtype_mark> of the
+@fa<subtype_indication>; any per-object constraints on subcomponents are
+elaborated (see 3.8) and any implicit initial values for the subcomponents
+of the object are obtained as determined by the @fa<subtype_indication>
+and assigned to the corresponding subcomponents. A check is made that the
+value of the object belongs to the designated subtype. Constraint_Error is
+raised if this check fails. This check and the initialization of the object are
+performed in an arbitrary order.>
+@dby
+@xbullet<If the designated type is composite, an object of the
+designated type is created with tag, if any, determined by
+the @fa<subtype_mark> of the @fa<subtype_indication>. This object is
+then initialized by default (see 3.3.1) using the @fa<subtype_indication> as
+its nominal subtype. A check is made that the value of the
+object belongs to the designated subtype. Constraint_Error is
+raised if this check fails. This check and the initialization
+of the object are performed in an arbitrary order.>
+
+!corrigendum 7.6(10)
+
+@drepl
+During the elaboration of an @fa<object_declaration>, for every controlled
+subcomponent of the object that is not assigned an initial value (as defined in
+3.3.1), Initialize is called on that subcomponent. Similarly, if the object as
+a whole is controlled and is not assigned an initial value, Initialize is
+called on the object. The same applies to the evaluation of an @fa<allocator>,
+as explained in 4.8.
+@dby
+During the elaboration or evaluation of a construct that causes an object to
+be initialized by default, for every controlled subcomponent of the object
+that is not assigned an initial value (as defined in 3.3.1), Initialize is
+called on that subcomponent. Similarly, if the object that is initialized by
+default as a whole is controlled, Initialize is called on the object.
+
+!corrigendum 7.6(11)
+
+@drepl
+For an @fa<extension_aggregate> whose @fa<ancestor_part> is a @fa<subtype_mark>,
+for each controlled subcomponent of the ancestor part, either Initialize is
+called, or its initial value is assigned, as appropriate Initialize is called
+on all controlled subcomponents of the ancestor part; if the type of the
+ancestor part is itself controlled, the Initialize procedure of the ancestor
+type is called, unless that Initialize procedure is abstract.
+@dby
+For an @fa<extension_aggregate> whose @fa<ancestor_part> is a @fa<subtype_mark>,
+if the type of the @fa<ancestor_part> is controlled, the Initialize procedure
+of the ancestor type is called, unless that Initialize procedure is abstract.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent