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,84b1828b2b26fc4f X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Common ancestor (visibility rules) Date: 2000/03/30 Message-ID: <38E3B8B8.55305DCB@averstar.com>#1/1 X-Deja-AN: 604498336 Content-Transfer-Encoding: 7bit References: <8bprin$a37$1@nnrp1.deja.com> <8bq726$lo8$1@nnrp1.deja.com> <8bsgpf$96f$1@nnrp1.deja.com> <8bskgp$ctu$1@nnrp1.deja.com> <8bt42b$tfe$1@nnrp1.deja.com> <8bu64t$60h$1@nnrp1.deja.com> <8bvjo3$n1k$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@inmet2.burl.averstar.com X-Trace: inmet2.burl.averstar.com 954448056 26492 141.199.8.164 (30 Mar 2000 20:27:36 GMT) Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 NNTP-Posting-Date: 30 Mar 2000 20:27:36 GMT Newsgroups: comp.lang.ada Date: 2000-03-30T20:27:36+00:00 List-Id: dmitry6243@my-deja.com wrote: > > In article <8bu64t$60h$1@nnrp1.deja.com>, > Robert Dewar wrote: > > > > with A; use A; -- OK with Aonix, error in GNAT > > >(v3.12) > > > > The above is perfectly fine, and compiles fine with all versions > > of GNAT, you are either compiling code different from what > > you quoted, or you have a messed up copy of GNAT. > > b-a.adb:1:13: "A" is not a usable package > In other words: > > 1. Fully qualified names cannot be used in WITH clause; > 2. Fully qualified names can be used in USE clause; GNAT has led you astray. There appears to be a bug in GNAT. The Aonix compiler is correct in accepting: with A; use A; and in rejecting with A; use Standard.A; It is true, but potentially confusing, that the visibility rules in context clauses (the with and use clauses that come in front of a compilation unit) and the visibility rules inside of a compilation unit are different. The visibility rules in context clauses are given in RM95 10.1.6 "Environment-Level Visibility Rules." The visibility rules are independent of the compilation unit that follows (though the *legality* rule 10.1.2(8) does depend on the compilation unit). The reason for these special visibility rules is that they are for a clause that precedes the compilation unit, and may affect some of the names used within the compilation unit spec, so there is a potential chicken-and-egg problem if the visibility in context clauses depended on the compilation unit that followed. In any case, the basic rule is that *all* names used in a context clause must be "full" expanded names, but *omitting* the "Standard." part. No hiding can happen, since only full names are allowed, all of which start at the same point in the name space (immediately within package Standard). In fact, "with Standard.A;" would be interpreted as requesting that the library unit whose name-from-the-very-root is Standard.Standard.A be made visible. Once you get inside a compilation unit, the rules are different, and full expanded names are not required, though they may be used to overcome name hiding. And names-from-the-very-root (i.e. those that start with Standard) may also be used. But as mentioned above, such names may *not* be used in context clauses. > Here "fully qualified name" stays for a name beginning from Standard (I > mean the predefined one). As a consequence, WITH and USE clauses use > different names. This is what I meant talking about "two diffrent kinds > of names". > > Had I figured it out? (:-)) As mentioned above, GNAT has misled you. The WITH and USE clauses that appear in a context clause both obey the "environment-level" visibility rules given in 10.1.6, with the added proviso that a USE clause can only mention a unit that has already been mentioned in a prior WITH clause. > > P.S. You know it for sure. Does ALRM cease to exist? It worked much > better to me. I cannot find a new version, mine is dated 1992! (:-(). There is a publically available ALRM on various web sites, including: http://www.adaic.org/standards/ada95.html > > Regards, > Dmitry Kazakov > > Sent via Deja.com http://www.deja.com/ > Before you buy. -- -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