comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Children of private compilation units
Date: 1999/05/19
Date: 1999-05-19T00:00:00+00:00	[thread overview]
Message-ID: <37430B99.698B22FB@averstar.com> (raw)
In-Reply-To: 7hslge$qad$1@nnrp1.deja.com

dennison@telepath.com wrote:
> 
> I have a situation where Gnat and ObjectAda are giving me conflicting
> results.

I believe ObjectAda is in the right (see below).

> The situation is basicly this
> 
> package A is ....
> 
> private package A.B is ...
> 
> package A.B.C is ...
> 
> with A.B.C;
> 
> procedure A.Fred is ...
> 
> This compiled fine for one developer using ObjectAda. But with Gnat, I
> get:
> current unit must also be private descendant of "JPATS_Aircraft_Body"
> on the with statement.

I presume you meant to say:  "current unit must also be private descendant
of package A".

> So what are compilers *supposed* to do in this situation? I can't find
> anything helpful in the LRM. Cohen seems to say this is OK. What's the
> truth?

The relevant RM paragraph is RM95 10.1.2(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.

The only possible source of confusion here is whether "procedure A.Fred is"
is a declaration or a body.  You might try creating a separate explicit
procedure "spec" for A.Fred and see whether GNAT likes it any better.
However, as you can see from the above RM wording, that shouldn't be
necessary, because even if there is no separate spec for A.Fred, it
is still a body (even if also a declaration), and so the second half of
the rule applies, meaning the with_clause is legal. 

I suppose another possible source of confusion is whether A.B.C is
a private child.  The answer is no, since the word "private" doesn't
appear on the declaration of C.  C is a public child of a private child
of A.  There are no restrictions on mentioning public children per-se,
even if one of their ancestors is private.  The error, if any, would
be on mentioning the private ancestor, and in this case, the private
ancestor is legal to mention, because A.Fred is the body of a 
descendant of A. 
> 
> --
> T.E.D.

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  reply	other threads:[~1999-05-19  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-18  0:00 Children of private compilation units dennison
1999-05-19  0:00 ` Tucker Taft [this message]
1999-05-25  0:00   ` Robert Dewar
1999-05-25  0:00     ` dennison
replies disabled

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