comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Language lawyer question - private packages.
Date: 1997/01/21
Date: 1997-01-21T00:00:00+00:00	[thread overview]
Message-ID: <E4DsBr.2B6@world.std.com> (raw)
In-Reply-To: 32E493CA.5001@ozemail.com.au


In article <32E493CA.5001@ozemail.com.au>,
Chris Miller  <chrismil@ozemail.com.au> wrote:
>One for the language lawyers.
>
>Assume that you have two sets of packages as followes :-
>
>   package A is ... end;
>   private package A.B is ... end;
>   package A.B.C is ... end;
>
>AND
>
>   package A is ... end;
>   private package A.B is ... end;
>   private package A.B.C is ... end;--  * different.

If you have a package A.Something_Else, then in the first example, it
can have "with A.B.C;" on its body, whereas in the second example, it
could not.  To any package outside the "A" hierarchy, it makes no
difference -- both A.B and A.B.C are invisible.

Think of the whole hierarchy.  The same rules apply at each level -- a
body (or private spec) can 'with' its private siblings, and a parent
body can 'with' its private children.  But not private grandchildren.
And remember that A is a (public) child of Standard.

In your second example, A.B.C is invisible outside the subsystem rooted
at A.B, whereas in your first example it is invisible outside the
subsystem rooted at A.

You can make subsystems and sub-subsystems, and sub-sub-systems, and so
forth.  For any given package, you need to understand that it is private
or public WITH RESPECT TO some particular ancestor -- that is, it might
be public with respect to its parent, but private with respect to its
grandparent.

Advice: Make packages "private" when you can.

- Bob




  reply	other threads:[~1997-01-21  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-21  0:00 Language lawyer question - private packages Chris Miller
1997-01-21  0:00 ` Robert A Duff [this message]
1997-01-21  0:00 ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox