Version 1.1 of ai05s/ai05-0122-1.txt
!standard 10.1.2(12-16/2) 08-10-17 AI05-0122-1/00
!class binding interpretation 08-10-17
!status work item 08-10-17
!status received 08-08-22
!priority Low
!difficulty Medium
!qualifier Omission
!subject Private with and generic children
!summary
** TBD **
!question
Consider the following:
generic
package Pak1 is
end Pak1;
generic
package Pak1.Pak2 is
end Pak1.Pak2;
generic
package Pak1.Pak2.Pak3 is
end Pak1.Pak2.Pak3;
with Pak1.Pak2;
private with Pak1.Pak2.Pak3;
package Pak4 is
package New_Pak1 is new Pak1;
package New_Pak2 is new New_Pak1.Pak2;
package New_Pak3 is new New_Pak2.Pak3; --
end Pak4;
It seems as though this ought to be illegal (since New_Pak3 doesn't occur
in a private part or body), but the wording in the Standard does not
support this. The instantiation is still within the scope of the WITH
clause for Pak1.Pak2.Pak3, since using PRIVATE on PRIVATE WITH doesn't
affect the scope of the WITH clause---it just makes certain uses to the
library unit name illegal in certain places. Therefore 10.1.1(19) still
applies. But nothing in 10.1.2(12-16) makes this illegal either, because
it only makes illegal certain uses of "A _name_ denoting a library item
that is visible due to being mentioned in one or more with_clauses that
include the reserved word PRIVATE"; and there is no _name_ in the body
of Pak4 that denotes Pak1.Pak2.Pak3 (New_Pak2.Pak3 certainly does not
denote this library item).
Should this be illegal? (Yes.)
!recommendation
(See Summary.)
!wording
** TBD **
!discussion
The answer is obvious, but how to get there is not at all obvious.
Likely we need some horrible glop of wording to handle just this
one silly case.
--!corrigendum 10.1.2(xx/2)
!ACATS Test
An ACATS B-Test like the example in the question is needed.
!appendix
!topic PRIVATE WITH and generic children of generics
!reference 10.1.2(12), 10.1.1(19)
!from Adam Beneschan 08-08-22
!discussion
Is this legal?
generic
package Pak1 is
end Pak1;
generic
package Pak1.Pak2 is
end Pak1.Pak2;
generic
package Pak1.Pak2.Pak3 is
end Pak1.Pak2.Pak3;
with Pak1.Pak2;
private with Pak1.Pak2.Pak3;
package Pak4 is
package New_Pak1 is new Pak1;
package New_Pak2 is new New_Pak1.Pak2;
package New_Pak3 is new New_Pak2.Pak3; -- legal??
end Pak4;
It seems as though this ought to be illegal (since New_Pak3 doesn't occur
in a private part or body), but I don't think the wording in the RM
supports this. The instantiation is still within the scope of the WITH
clause for Pak1.Pak2.Pak3, since using PRIVATE on PRIVATE WITH doesn't
affect the scope of the WITH clause---it just makes certain uses to the
library unit name illegal in certain places. Therefore 10.1.1(19) still
applies. But nothing in 10.1.2(12-16) makes this illegal either, because
it only makes illegal certain uses of "A _name_ denoting a library item
that is visible due to being mentioned in one or more with_clauses that
include the reserved word PRIVATE"; and there is no _name_ in the body
of Pak4 that denotes Pak1.Pak2.Pak3 (New_Pak2.Pak3 certainly does not
denote this library item).
****************************************************************
From: Tucker Taft
Sent: Friday, August 22, 2008 11:04 AM
Yes this is supposed to be illegal, and yes it looks like the wording
is inadequate in general to properly handle children of generics.
****************************************************************
Questions? Ask the ACAA Technical Agent