Version 1.1.1.1 of ais/ai-00183.txt
!standard 03.09.02 (01) 97-11-14 AI95-00183/02
!class confirmation 97-03-19
!status WG9 Approved 97-11-14
!status ARG Approved 7-0-0 97-04-11
!status work item 97-03-19
!status received 97-03-19
!priority High
!difficulty Medium
!subject Primitive operations declared before it is known if the type is tagged
!summary 97-05-08
Consider a type whose partial view is untagged, but whose full view is
tagged. A primitive subprogram declared for the partial view is a
dispatching subprogram of the full view.
Therefore, if there are two types, T1 and T2, and there is a primitive
subprogram of both:
procedure Primitive(X: T1; Y: T2);
then it is illegal for both T1 and T2 to be tagged, even if the full
type declarations occur after Primitive.
!question 97-05-08
Is a primitive operation of a type which is declared before it is known
that the type is tagged a dispatching operation?
This question matters because RM95 3.9.2(12) states that "A given
subprogram shall not be a dispatching operation of two or more distinct
tagged types."
Consider the following examples:
package P1 is
type T1 is private;
type T2 is private;
procedure P (X1 : T1; X2 : T2); --
private
type T1 is tagged null record;
type T2 is tagged null record;
end;
package P2 is
private
type T1;
type T2;
procedure P (X1 : access T1; X2 : access T2);
--
end;
package body P2 is
type T1 is tagged null record;
type T2 is tagged null record;
end;
!response 97-05-08
(See Summary.)
!appendix
!section 3.9.2(01)
!subject Primitive operations declared before it is known if the type is tagged
!reference RM95 3.9.2(1)
!reference RM95 3.9.2(12)
!from Pascal Leroy 97-03-10
!reference 97-15727.d Pascal Leroy 97-3-10>>
!discussion
Is a primitive operation of a type which is declared before it is known that
the type is tagged a dispatching operation?
This question matters because RM95 3.9.2(12) states that "A given subprogram
shall not be a dispatching operation of two or more distinct tagged types."
Consider the following examples:
package P1 is
type T1 is private;
type T2 is private;
procedure P (X1 : T1; X2 : T2); -- violates 3.9.2(12) ?
private
type T1 is tagged null record;
type T2 is tagged null record;
end;
package P2 is
private
type T1;
type T2;
procedure P (X1 : access T1; X2 : access T2); -- violates 3.9.2(12) ?
end;
package body P2 is
type T1 is tagged null record;
type T2 is tagged null record;
end;
It seems that the declarations of P1.P and P2.P should be illegal, but that
cannot be inferred from the manual.
****************************************************************
Questions? Ask the ACAA Technical Agent