Version 1.1 of ais/ai-00006.txt

Unformatted version of ais/ai-00006.txt version 1.1
Other versions for file ais/ai-00006.txt

!standard 10.01.02 (08)          96-11-16 AI95-00006/01
!class confirmation 95-06-25
!status WG9 approved 96-12-07
!status ARG Approved 10-0-0 96-10-07
!status work item 95-06-25
!status received 95-06-25
!priority Low
!difficulty Medium
!subject private child in with_clause
!summary 95-06-25
The body of a library unit may mention one of its private children in a with_clause.
!question 95-06-25
10.1.2(8) says:
8 If a with_clause of a given compilation_unit mentions a private child of some library unit, then the given compilation_unit shall be either the declaration of a private descendant of that library unit or the body or subunit of a [(public or private)] descendant of that library unit.
Does this allow the body of a library unit to mention one of its own children in a with_clause, even if that child is private? (Yes.)
!response 95-06-25
A library unit is a descendant of itself (see 10.1.1(11)). Therefore, 10.1.2(8) allows the body of a library unit to mention one of its private children in a with_clause.
!appendix

!section 10.1.2(8)
!subject private child in with_clause
!reference RM95-10.1.2(8)
!from Anthony Gargaro 95-01-16
!reference as: 95-5061.a Anthony Gargaro  95-1-16>>
!discussion

Paragraph 10.1.2(8) seems to disallow a with_clause of a package body from
mentioning a private child unless the package is a descendant of the parent of
the private child. For example, the following package body for A appears to be
in violation of this paragraph (applying the definition of descendant in
10.1.1(11)).

package A is
  function Value return Integer;
end A;

private package A.B is
  Val : Integer := 1;
end A.B;

with A.B, Text_IO;
package body A is
  function Value return Integer is
  begin
    return A.B.Val;
  end Value;
begin
  Text_IO.Put_Line (Integer'Image(Value));
end A;

Is this a correct reading of the paragraph 10.1.2(8)?


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

!section 10.1.2(8)
!subject private child in with_clause
!reference RM95-10.1.2(8)
!reference 95-5061.a Anthony Gargaro 95-01-16
!from Gary Dismukes 95-01-16
!reference as: 95-5062.a Gary Dismukes 95-1-16>>
!discussion

Anthony Gargaro wrote:
>
> Paragraph 10.1.2(8) seems to disallow a with_clause of a package body from
> mentioning a private child unless the package is a descendant of the parent of
> the private child. For example, the following package body for A appears to be
> in violation of this paragraph (applying the definition of descendant in
> 10.1.1(11)).
>
> ...
>
> Is this a correct reading of the paragraph 10.1.2(8)?

I believe your conclusion is incorrect, based on a misreading of
10.1.1(11), which reads (in part):

  ... The ancestors of a library unit are itself, its parent, its parent's
  parent, and so on. ... The descendant relation is the inverse of the
  ancestor relation.

I read this to mean that a library unit is a descendant of itself,
so the body of a library unit can certainly give a with clause for
one of its private child units (as one would expect).

-- Gary


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

Questions? Ask the ACAA Technical Agent