From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8f5d49733f921b0 X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Children of private compilation units Date: 1999/05/19 Message-ID: <37430B99.698B22FB@averstar.com>#1/1 X-Deja-AN: 479733778 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <7hslge$qad$1@nnrp1.deja.com> Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-19T00:00:00+00:00 List-Id: 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