Version 1.4 of ai05s/ai05-0129-1.txt
!standard 10.1.1(12.2/2) 09-01-16 AI05-0129-1/02
!standard 10.1.1(12.3/2)
!class binding interpretation 08-11-23
!status work item 08-11-23
!status received 08-11-23
!priority Low
!difficulty Medium
!qualifier Error
!subject A limited view does not contain views of incomplete types
!summary
A limited view of a package does not contain incomplete views of incomplete
types declared in the package.
Private parts of limited views of packages are empty.
!question
A question raised by discussion of the ASIS semantic subsystem at the
Portland ARG meeting has led to discovery of a bug in the Ada Standard.
Someone wondered if the definition of completion was clear in the case
of an incomplete view that is declared in a limited view for an incomplete
type. For instance, in the limited view of the following package:
package P is
type T; --
type Acc_T is access T;
type T is null record; --
end P;
is the completion of T declaration (1) or (2)?
The question arises because both (1) and (2) are type_declarations by
3.2.1(2), so 10.1.1(12.3/2) says that an incomplete view is defined for
both declarations. The language does not provide a way to chose between
them, indeed, they would appear to be illegal homographs.
What is the intent here? (No limited view is declared of (1)).
Another problem noted by the Portland meeting is that the wording of
10.1.1(12.2/2) does not exclude nested packages declared in the private part
of the enclosing package. Types declared in the private part are excluded
by 10.1.1(12.3/2), so it appears that this is intentional. Is this the
intent? (No.)
!recommendation
(See Summary.)
!wording
Modify 10.1.1(12.2/2),
* For each nested package_declaration{ in the visible part}, a declaration of the
limited view of that package, with the same defining_program_unit_name.
Modify 10.1.1(12.3/3):
* For each type_declaration {that is not an incomplete_type_declaration} in the
visible part, an incomplete view of the type; if the type_declaration
is tagged, then the view is a tagged incomplete view.
!discussion
Two identical (except for the completion) incomplete views with the same
name in a single scope would seem to be an illegal homograph. Neither of these
declarations is the completion of the other, nor do any of the other hidden
from all visibility rules apply. So 8.3(26/2) seems to say that the limited
view is illegal. But of course that is nonsense; we need to hide one of the
declarations somehow.
But we can do better than fiddling with the visibility rules.
3.10.1(3) requires the completion of an incomplete type in a visible part
to be in that same visible part. That means that there is no need for an
incomplete view of the incomplete type to be declared in the limited view;
there will always be an incomplete view of the completion in the same limited
view.
So we adjust the wording to eliminate the declaration of incomplete views
of incomplete types in a limited view.
For the second question, it would make no sense to include nested packages in
the private part in the limited view, but not the associated types. We adjust
the wording to make these consistent.
!corrigendum 10.1.1(12.2/2)
Replace the paragraph:
- For each nested package_declaration, a declaration of the
limited view of that package, with the same defining_program_unit_name.
by:
- For each nested package_declaration in the visible part, a
declaration of the limited view of that package, with the same
defining_program_unit_name.
!corrigendum 10.1.1(12.3/2)
Replace the paragraph:
- For each type_declaration in the visible part, an incomplete
view of the type; if the type_declaration is tagged, then the view
is a tagged incomplete view.
by:
- For each type_declaration that is not an
incomplete_type_declaration in the visible part, an incomplete
view of the type; if the type_declaration
is tagged, then the view is a tagged incomplete view.
!ACATS Test
An ACATS B-Test like the example in the question is needed.
!appendix
From: Steve Baird
Date: Monday, January 5, 2009 5:50 PM
This new AI is part of my homework from the Portland meeting.
------------
!subject private parts of limited views
!summary
Private parts of limited views of packages are empty.
!problem
The wording of 10.1.1(12.2/2) fails to exclude nested packages declared in the
private part of the enclosing package. This case is handled correctly for types
in 10.1.1(12.3/3).
There also appears to be a missing space in 12.3/3 ("typewith" should be two words).
!proposal
In 12.2/2, echo the (correct) wording of 12.3/3.
In 12.3/3, fix the typo.
!wording
In 10.1.1(12.2/2),
"For each nested package_declaration [in the visible part], ..."
In 12.3/3 "typewith" => "type with".
****************************************************************
From: Randy Brukardt
Date: Monday, January 5, 2009 8:12 PM
I think this AI should be combined with AI05-0129-1, which was some of my
homework from Portland. They're both about bugs in the definition of limited
views. The fixes are in adjoining sentences. Any objections??
> ------------
...
> There also appears to be a missing space in 12.3/3 ("typewith" should
> be two words).
For some reason, this doesn't show up in the AARM (which is why I didn't see it).
"discriminant_part" is also in the wrong font. I've fixed both for the next version.
(This doesn't need to be in an AI, as it is merely an editorial glitch.)
****************************************************************
From: Steve Baird
Date: Tuesday, January 6, 2009 9:45 AM
> Any objections??
No.
****************************************************************
Questions? Ask the ACAA Technical Agent