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.107.192.66 with SMTP id q63mr16132362iof.43.1510678174049; Tue, 14 Nov 2017 08:49:34 -0800 (PST) X-Received: by 10.157.51.119 with SMTP id u52mr953213otd.6.1510678173937; Tue, 14 Nov 2017 08:49:33 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!l196no3402884itl.0!news-out.google.com!x87ni4413ita.0!nntp.google.com!l196no3402882itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 14 Nov 2017 08:49:33 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:511:c903:74cf:caed; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:511:c903:74cf:caed References: <6a5368c5-f015-4dcb-9291-e77b40fa1bf1@googlegroups.com> <39330489-ec8b-481f-bcff-a5b7d1a2d8e3@googlegroups.com> <7c68eace-8a03-4bfc-806d-aa78a453f97f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <25bdc1ab-0d2b-4e13-b726-42c49538e1c4@googlegroups.com> Subject: Re: some trivial questions? From: Robert Eachus Injection-Date: Tue, 14 Nov 2017 16:49:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3418 X-Received-Body-CRC: 2692688972 Xref: feeder.eternal-september.org comp.lang.ada:48888 Date: 2017-11-14T08:49:33-08:00 List-Id: On Saturday, November 11, 2017 at 6:32:14 AM UTC-5, AdaMagica wrote: > But the with-clause is not about dependence, it's only about visibility. No! Come on guys, the with clause does affect visibility, but it has a lot= of other effects. The use clause is only about (direct) visibility. =20 However, the important thing which I have not seen mentioned here, is that = the parsing for with clauses is completely different from the parsing for u= se clauses. Assuming that the compiler has the concept of a library, the w= ith clause searches the LIBRARY for compilation units and adds them to the = program. The use clause searches NAMES visible at the point of the use cla= use, and if legal adds the names visible in the named unit to the list of v= isible names. If the use clause is in a context clause, the names become (p= otentially) visible in the declaration following the context clause. One of my two line compiler killers back in the early sixties (before compi= ler validations) was: with Text_IO; use ASCII, Text_IO; procedure Main is begin Put(Nul); end; Special casing ASCII could handle this, but there are many other instances = where a use clause in a context clause doesn't need to reference the same c= ontext clause, for example on the body of a package. In 90+% of cases, a "with and use" clause would work. It was even consider= ed for Ada 9X. But the problem with it was that the rules for what it mean= t--other than making it syntactic sugar for "with Foo; use Foo;" would be a= lmost impossible to understand. Trying to explain to a user why with and u= se failed was seen as too big an unnecessary addition to the language. Addi= ng qualified names for compilation units (Ada.Text_IO) was considered much = more important.