Version 1.1.1.1 of ais/ai-00043.txt

Unformatted version of ais/ai-00043.txt version 1.1.1.1
Other versions for file ais/ai-00043.txt

!standard 12.05 (08)          96-02-06 AI95-00043/02
!class binding interpretation 95-06-25
!status WG9 approved 95-06-14
!status ARG approved (subject to editorial review) 8-0-3 95-11-01
!status received 95-06-25
!subject Predefined Operators for Generic Formal Array Types
!summary 95-06-25
For a generic formal type whose properties depend on a partial view, (for example, a formal array type whose component type is a private type), the rules of 7.3.1 apply. Thus, the primitive subprograms of the formal type are not necessarily declared immediately after its declaration.
!question 95-06-25
There is an inconsistency between paragraphs 7.3.1(3) and 12.5(8) regarding predefined operators for formal array types in some rare cases. The former says that additional predefined operators may be declared when additional characteristics of the component type become known, whereas 12.5(8) says that all predefined operators are declared immediately after the formal type declaration.
Example:
package P is pragma Elaborate_Body; -- just to make its body legal
type Pt is private;
generic type Ft is array( 1 .. 9 ) of Pt; package G is end G;
private type Pt is new Boolean; end P;
package body P is
package body G is -- relational operators declared for Ft here ? -- 12.5(8) says no, 7.3.1(3) says yes end G;
end P;
(A similar example could be made using a public generic child unit to P, in which case the relational operators would (?) be declared when entering the private part of the public child).
!recommendation 95-06-25
For a generic formal type whose properties depend on a partial view, (for example, a formal array type whose component type is a private type), the rules of 7.3.1 apply. Thus, the primitive subprograms of the formal type are not necessarily declared immediately after its declaration.
!wording 95-06-25
!discussion 95-06-25
7.3.1(3) and 12.5(8) are in conflict for generic formal types. 7.3.1(3) should take precedence, since otherwise the privacy of private types would be violated. Furthermore, this interpretation is compatible with Ada 83.
!appendix

!section 12.5(8)
!section 7.3.1(3)
!subject Predefined Operators for Generic Formal Array Types
!reference AARM-12.5(8);6.0
!reference AARM-7.3.1(3);6.0
!from Jesper Joergensen 95-04-26
!reference as: 95-5129.a Jesper Joergensen 95-4-26>>
!discussion

It seems to me there is an inconsistency between the paragraphs 7.3.1(3) and
12.5(8) regarding predefined operators for formal array types in some rare
cases. The former says that additional predefined operators may be declared
when additional characteristics of the component type becomes known, whereas
12.5(8) says that all predefined operators are declared immediately after the
formal type declaration.

Example:

   package P is
      pragma Elaborate_Body;   -- just to make its body legal

      type Pt is private;

      generic
         type Ft is array( 1 .. 9 ) of Pt;
      package G is
      end G;

   private
      type Pt is new Boolean;
   end P;


   package body P is

      package body G is
         -- relational operators declared for Ft here ?
         -- 12.5(8) says no, 7.3.1(3) says yes
      end G;

   end P;


(A similar example could be made using a public generic child unit to P, in
which case the relational operators would (?) be declared when entering the
private part of the public child).

Maybe 7.3.1(3) was not intended to cover the formal array types or maybe I have
simply overlooked something. What was the intention?

/Jesper


****************************************************************

Questions? Ask the ACAA Technical Agent