Version 1.1 of ai05s/ai05-0150-1.txt

Unformatted version of ai05s/ai05-0150-1.txt version 1.1
Other versions for file ai05s/ai05-0150-1.txt

!standard 8.4(4)          09-04-22 AI05-0150-1/01
!standard 8.4(8/2)
!class Amendment 09-04-22
!status work item 09-04-22
!status received 09-04-22
!priority Medium
!difficulty Medium
!subject Use all type clause
!summary
Add "use all type" to provide a more powerful form of use_type_clause.
!problem
There have been complaints that a use type clause does not make enough things visible (e.g. enumeration literals, classwide operations for tagged types), whereas a use_package_clause makes too much visible. Something in between is wanted.
!proposal
Provide a more powerful form of use_type_clause, specified by including the reserved word "all", as in
use all T;
This new form extends the set of declarations whose visibility is modified by a use type clause to include primitive operators of the type and (if the type is tagged) subprograms that operate on T'Class.
!wording
Modify 8.4(4) to add optional "all" reserved word syntax:
use_type_clause ::= use [all] type subtype_mark {, subtype_mark};
Add to the end of 8.4(8/2):
If a use_type_clause includes the reserved word "all", then the following additional declarations are also made potentially use-visible in the same way as is done for the primitive operators of T:
- The visible primitive subprograms of T; - If T is a tagged type declared immediately within a
package_specification, then any visible subprograms that are declared immediately within the same package_specification and operate on T'Class.
!example
package P is type Enum is (Aa, Bb, Cc); type T is tagged null record; procedure Proc (X : T'Class; Y : Enum); end P;
with P; package Q is subtype T_Sub is P.T; subtype E_Sub is P.Enum; end Q;
with Q; procedure R is use all type Q.T_Sub; use all type Q.E_Sub; Z : P.T; begin Proc (X => Z, Y => Bb); end R;
--!corrigendum 8.4(4) --!corrigendum 8.4(8/2)
!ACATS test
Add ACATS tests for this new feature.
!appendix

This AI was split from AI05-0135-1; there is a small amount of discussion
on this idea in the volumous e-mail in that AI (mostly at the start).

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



Questions? Ask the ACAA Technical Agent