Version 1.1 of ais/ai-00032.txt

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

!standard 08.02 (05)          96-11-16 AI95-00032/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-07-06
!status received 95-06-25
!priority Low
!difficulty Easy
!subject visible part of a renaming
!summary 95-06-25
A library_unit_renaming_declaration must mention the renamed library unit in a with_clause. The renamed unit must be a library unit.
!question 95-06-25
Is this legal? (No.) It would seem to allow exportation of private information.
package P is private procedure Q; end;
procedure P.R renames P.Q; -- Illegal!
!response 95-06-25
P.Q is not a library unit, so cannot be renamed as a library unit, according to 10.1.1(14). If we changed the private declaration of Q into a private child P.Q, the renaming would still be illegal, because it does not mention P.Q in a with_clause, so P.Q is not visible. And such a with_clause would be illegal by 10.1.2(8).
!appendix

!section 8.2(5)
!section 8.2(4)
!subject visible part of a renaming
!reference AARM-8.2(5-9)
!reference AARM-8.2(4)
!from Jesper Joergensen 95-02-15
!keywords visible part, child unit, private child unit
!reference as: 95-5106.a Jesper Joergensen 95-3-6>>
!discussion

I sent the following comment to ada-comment@sw-eng.fa...... but got absolutely
no reaction.  Since it seems that this mailing list is still active, I try
here.

The rule 8.2(4) prevents entities declared in the private part of a library
unit to be visible in the visible part of its public children. However, the
rules defining visible parts [8.2(5-9)] do not mention renamings. Therefore,
I think that the following is actually legal although it should not be,
because a private declaration is made externally visible:


   package P is
   private
      procedure Q;
   end;


   procedure P.R renames P.Q;


Please, tell me that I'm wrong!


   /Jesper Joergensen, DDC-I




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

!section 8.2(5)
!section 8.2(4)
!subject visible part of a renaming
!reference AARM-8.2(5-9)
!reference AARM-8.2(4)
!reference 95-5106.a Jesper Joergensen 95-02-15
!keywords visible part, child unit, private child unit
!from Tucker Taft 95-03-06
!reference as: 95-5107.a Tucker Taft 95-3-6>>
!discussion

> I sent the following comment to ada-comment@sw-eng.fa...... but got absolutely
> no reaction.  Since it seems that this mailing list is still active, I try
> here.

We have not yet started using that mailing list.  We will try to get
it at least so that it forwards mail to "ada9x-mrt@inmet.com" in the
near future.

> The rule 8.2(4) prevents entities declared in the private part of a library
> unit to be visible in the visible part of its public children. However, the
> rules defining visible parts [8.2(5-9)] do not mention renamings. Therefore,
> I think that the following is actually legal although it should not be,
> because a private declaration is made externally visible:
>
>
>    package P is
>    private
>       procedure Q;
>    end;
>
>
>    procedure P.R renames P.Q;

This is not legal, because "P.Q" is not visible.  You need to add
a "with" clause that mentions "P.Q". Having done that, you will
necessarily have to make this library unit renaming into a private
child.

> Please, tell me that I'm wrong!

Happily, you are wrong.  See above.

>    /Jesper Joergensen, DDC-I

-Tuck

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

!section 8.2(5)
!section 8.2(4)
!subject visible part of a renaming
!reference AARM-8.2(5-9)
!reference AARM-8.2(4)
!reference 95-5106.a Jesper Joergensen 95-02-15
!keywords visible part, child unit, private child unit
!reference 95-5107.a
!from Bob Duff
!reference as: 95-5186.a Robert A Duff 95-6-27>>
!discussion

> > The rule 8.2(4) prevents entities declared in the private part of a library
> > unit to be visible in the visible part of its public children. However, the
> > rules defining visible parts [8.2(5-9)] do not mention renamings. Therefore,
> > I think that the following is actually legal although it should not be,
> > because a private declaration is made externally visible:
> >
> >
> >    package P is
> >    private
> >       procedure Q;
> >    end;
> >
> >
> >    procedure P.R renames P.Q;
> 
> This is not legal, because "P.Q" is not visible.  You need to add
> a "with" clause that mentions "P.Q". Having done that, you will
> necessarily have to make this library unit renaming into a private
> child.

Actually, P.Q is not a library unit, so you can't "with" it.
By 10.1.1(14), you can't rename it using a
library_unit_renaming_declaration.

> > Please, tell me that I'm wrong!
> 
> Happily, you are wrong.  See above.

For a different reason.

- Bob

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

Questions? Ask the ACAA Technical Agent