!ASIS Issue #097 !topic Names for components of derived records !reference ASIS 95-17.6,17.36 !from Sergey Rybin 98-07-25 !keywords derived records types components !discussion I'm afraid I've found one more thing in the current ASIS definition which needs clarification. Consider 17.6, "function Corresponding_Name_Definition". It says: -- - Record component references, return the defining name of the -- record discriminant or component_declaration. For derived types, the -- result is an Is_Part_Of_Implicit structural (syntactic) -- component from the declaration of the parent type definition. Suppose we have X as a reference to a component of a derived record type. According to this paragraph, the result of applying Corresponding_Name_Definition to it should be an implicit component "from the declaration of the parent type definition". Let Y := Corresponding_Name_Definition (X); The question is: what is Enclosing_Element (Y)? It looks like it should be a component definition "of the parent type definition". Well, let Z := Enclosing_Element (Y); Is Z implicit or explicit? And the next question - what is Enclosing_Element (Z)? Is it "the parent type definition"? And what kind of Element should we get on this stage of applying Enclosing_Element - Implicit or explicit? ASIS 17.6 says, that in case of a reference to a component of a derived record type the result of Corresponding_Name_Definition should be a component defining name from the declaration of the _PARENT_ type definition. But from the other side, RM 95 says in 3.4(14), that all the components of a derived record type are implicitly declared "within the declarative region of the [_derived_] type". Probably, more logical approach for the references of the components of derived record types would be: - Corresponding_Name_Definition returns Is_Part_Of_Implicit defining name of a component; - Enclosing_Element, when applied to such a defining name, returns Is_Part_Of_Implicit A_Component_Declaration/A_Discriminant_Specification; - When applied again to this implicit component/discriminant declaration, Enclosing_Element returns an _explicit_ declaration of this _derived_ type (but not of the _parent_ type) Sergey !resolution Accept, with Modification !date 98-07-29 Change Clause 17.6, function Corresponding_Name_Definition, from: -- - Record component references, return the defining name of the -- record discriminant or component_declaration. For derived types, the -- result is an Is_Part_Of_Implicit structural (syntactic) -- component from the declaration of the parent type definition. To: -- - Record component references return the defining name of the -- record discriminant or component_declaration. For references -- to inherited declarations of derived types, the -- Corresponding_Name_Definition returns the defining name of the -- implicit inherited declaration.