!standard 12.05.01 (21) 98-03-27 AI95-00202/00 !class binding interpretation 98-03-27 !status received 98-03-27 !priority Medium !difficulty Hard !subject Primitives of formal type derived from another formal type !summary 98-03-27 !question 98-03-27 !recommendation 98-03-27 !wording 98-03-27 !discussion 98-03-27 !appendix 98-03-27 !section 12.5.1(21) !subject Primitives of formal type derived from another formal type !reference RM95-12.5.1(21) !reference AARM-12.5.1(21.a) !from Todd Allen 98-02-27 !keywords generic formal derived type, ancestor subtype, primitive !reference 1998-15814.a Todd Allen 1998-2-27>> !discussion In an instance of a generic where a formal derived type whose ancestor type is another formal type, the rules regarding the meanings of the implicit declarations for the formal derived type produce a peculiar result. Consider the following example: package P1 is type R1 is record .. end record; procedure S (x : R1); -- (1) end P1; use P1; generic type F2 is new R1; -- implicit: procedure S (x : F2); -- (2) type F3 is new F2; -- implicit: procedure S (x : F3); -- (3) procedure G (o2 : F2; o3 : F3); procedure G (o2 : F2; o3 : F3) is begin S(o2); S(o3); -- Peculiar result end G; package P2 is type R2 is new R1; -- implicit: procedure S (x : R2); -- (4) procedure S (x : R2); -- (5) end P2; use P2; package P3 is type R3 is new R2; -- implicit: procedure S (x : R3); -- (6) procedure S (x : r3); -- (7) end P3; use P3; procedure I is new G(R2, R3); In the instance I, the implicit declarations of S which operate on F2 and F3, respectively are the corresponding primitive subprograms of the ancestor types of each type, as stated in RM95 12.5.1(21). The ancestor type of F2 is R1, so the implicit declaration of S that operates on F2 (2) is a view of the corresponding primitive subprogram of R1 (1). The ancestor type of F3 is the type of the subtype denoted by the name F2 in the instance, which is R2. So, the implicit declaration of S that operates on F3 (3) is a view of the corresponding primitive subprogram of R2 (5). But, the annotation in AARM 12.5.1(21.a) indicates that the reason the primitives of a formal derived type in an instance are views of its ancestor's primitives is because the primitives of its actual type might not be subtype conformant with those of its ancestor type. This intention could be violated if the primitive S (3) is a view of the primitive S (5). Our belief is that intent was that the primitive S (3) should instead declare a view of S (1). -- Todd Allen Concurrent Computer Corporation Fort Lauderdale, FL 33309 ****************************************************************