!standard 7.3.3(3/5) 20-09-03 AI12-0397-1/01 !standard 7.3.3(6/5) !standard 7.3.3(8/5) !class Amendment 20-09-03 !status work item 20-09-03 !status received 20-09-03 !priority Low !difficulty Easy !subject Default_Initial_Condition applied to derived type !summary The Default_Initial_Condition expression of an ancestor type applies to a descendant according to rules analogous to those used for a Post'Class expression, meaning that any operations that take the current instance as a parameter must be primitives of the type, and in the descendant they represent the corresponding primitive. !problem A Default_Initial_Condition specified for a type T applies to all descendants of type T. How does that work if the Default_Initial_Condition includes functions that are not defined on the descendant? How does that work if the Default_Initial_Condition invokes a primitive of type T? When applied to a descendant, does it invoke the corresponding primitive of the descendant, or does it invoke the original primitive on a view conversion of the object to type T? All of these questions be answered in the normative wording. !proposal It is natural to define a Default_Initial_Condition of a type T in terms of the results produced by various functions that are primitive operations of T. We propose to interpret these much the same way they are interpreted for Post'Class expressions, where the current instance of T is treated as though it is of a notional formal derived type with ancestor being type T, and the only operations defined on it would be the primitives of such a formal type. !wording Add after 7.3.3(3/5): Within a default initial condition expression associated with a declaration for a type T, a name that denotes the declaration is interpreted as a current instance of a notional (nonabstract) formal derived type NT with ancestor T, that has directly visible primitive operations. Modify 7.3.3(6/5): If one or more default initial condition expressions apply to a {[Redundant: (nonabstract)]} type T, then a default initial condition check is performed after successful initialization of an object of type T by default (see 3.3.1). In the case of a controlled type, the check is performed after the call to the type's Initialize procedure (see 7.6). {AARM Proof: If T is an abstract type, then there will never be an initialization of an object of the type.} Modify 7.3.3(8/5): The default initial condition check consists of the evaluation of each enabled default initial condition expression that applies to T. {Any operations within such an expression that were resolved as primitive operations of the (notional) formal derived type NT, are in the evaluation of the expression bound to the corresponding operations of type T.} These evaluations, if there are more than one, are performed in an arbitrary order. If any of these evaluate to False, Assertions.Assertion_Error is raised at the point of the object initialization. !discussion It should not be necessary to re-specify the same Default_Initial_Condition on each descendant, but it may be desirable to enforce additional conditions, so we have said that the Default_Initial_Condition for a type applies to all of its descendants. We allow the descendants to define their own Default_Initial_Condition, but these new conditions are "layered on top" and must also evaluate to true. This approach is analogous to the rules used for Post'Class. Unfortunately, we did not define the name resolution rules for Default_Initial_Condition expression for a type T, so it is not clear what it means when applied to descendants. We have proposed to use rules analogous to those for Post'Class, basing it on the notion of a formal derived type NT with ancestor type T. This seems the most flexible, and means you can read the Default_Initial_Condition of an ancestor, and understand what it means in terms of the descendant. It also means you can apply it to an abstract type, and have it well defined for nonabstract descendants. !ASIS No ASIS effect. !ACATS test ACATS B- and C-Tests are needed to check that the new rules are enforced/used. !appendix ****************************************************************