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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.52.184.104 with SMTP id et8mr20124801vdc.4.1405007692956; Thu, 10 Jul 2014 08:54:52 -0700 (PDT) X-Received: by 10.182.215.193 with SMTP id ok1mr24901obc.28.1405007692694; Thu, 10 Jul 2014 08:54:52 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!m5no763169qaj.1!news-out.google.com!gf2ni5igb.0!nntp.google.com!hn18no255862igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 10 Jul 2014 08:54:52 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: <33fbd821-cb30-4be9-93c1-17002470413e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Position of "use" From: Adam Beneschan Injection-Date: Thu, 10 Jul 2014 15:54:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3869 X-Received-Body-CRC: 4150335171 Xref: news.eternal-september.org comp.lang.ada:20841 Date: 2014-07-10T08:54:52-07:00 List-Id: On Wednesday, July 9, 2014 6:27:08 PM UTC-7, an...@att.net wrote: > Actually, the comments for compilation_unit 4 are correct under multiple= =20 > compilation_unit type files, which GNAT does not support. It was tested= =20 > under AdaEd-1.11.0a compiled for SuSE Linux, before I posted a condensed= =20 > version. The language rules are clear. 10.1.2(5) says that the scope of a with_clau= se that appears on a library unit declaration consists of the entire declar= ative region of the *declaration*, which includes all children and subunits= (and, by 8.1(8), includes the package body if the with_clause appears on a= package specification). If a file contains two compilation units, they ar= e two separate declarations. Therefore, unless the second declaration is a= body or child unit or subunit of the first one, the scope of a with_clause= on the first unit in a file does not include the second unit. The fact that one or another compiler accepts it means nothing. Compilers = have bugs. Compiler bugs that allow illegal code to be accepted are given = less attention, in my experience, than compiler bugs that reject legal Ada = code or generate incorrect object code. That's certainly the case with GNA= T, which has a number of bugs in which illegal code is accepted (which unfo= rtunately means that open-source Ada projects that get put on the Internet = sometimes have illegal Ada in them). But to determine whether a construct = is legal or an identifier is visible or whatever, you have to check the lan= guage standard; you cannot count on a compiler to get it 100% right. > For multiple compilation_unit, likes those files found in ACVC, the=20 > external visibility starts with the "with_clause" and that clause=20 > grants all succeeding compilation_unit(s) access to that package or=20 > routine no matter how many compilation_unit there are. In other words=20 > you only need one "with_clause" for Ada compilers that support multiple= =20 > compilation_unit in the same file.=20 No, that isn't true. It may *appear* to be true in the ACATS because a lat= er compilation unit is often the completion (body) of an earlier one, or it= 's a child unit. And, as I pointed out, with_clauses on package specs *do*= apply to their bodies and child units. But if you can find a case where a= with_clause on one package in a ACATS file applies to a later *unrelated* = package, please post it. (But really, don't bother, because there aren't a= ny. If there were, our compiler would have caught it a long time ago.) -- Adam