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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60e2922351e0e780 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-16 11:31:26 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 16 Nov 2003 13:31:24 -0600 Date: Sun, 16 Nov 2003 14:31:23 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Clause "with and use" References: <3FB1609E.D56E315C@fakeaddress.nil> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.34.214.193 X-Trace: sv3-wycWG8WT2cEi3iIUz/N8PmPjJOIJUoiYezWMlnDQFSYTVN+JSOWxAYc7iUTWerhkp/onVVdjDKVRuzi!ikHbpDZ8qzxUaIKVg70aohZh/+81QvkjWo7T568P85/8aYbbqsI4PP99ifMfxw== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:2545 Date: 2003-11-16T14:31:23-05:00 List-Id: > I said: > Try compiling: >> >>procedure Junk is >> use Ascii; >>begin null; end Junk; >> >>If you have any doubts about that. Russ wrote: > Mr. Eachus, I'll admit that my point was very unclear, perhaps even > obtuse, but I think it should have been clear that my point was *not* > what you thought it was. If I really thought that "use" literally > implies "with", then why would I be arguing that "use" should imply > "with"? Then you didn't try compiling that litte code fragment. The: use Ascii; procedure Junk is beging null; end Junk; That Gautier wrote may cause problems for some compilers, and I wouldn't worry about it. (Especially since I'm probably the guy who wrote the test that shot them down in Ada 83 if they did allow it.) But the example as posted is legal Ada 83 and Ada 95. > My point was as follows. If you use "use" without preceding it with > "with" (no pun intended), the compiler will obviously squawk at you. > The compiler is telling you that you should have had a "with" > statement. In other words, the compiler is telling that "use" > *requires* "with". So in a sense, it implies it. It was a poor way to > make the point. Please forget I wrote it. I can't forget it. Because Ada doesn't work that way. In Ada with and use have two different meanings, different scopes where they are allowed and in some cases different rules for name resolution. There is a whole clause of the RM 10.1.6 Environment-Level Visibility Rules, that discusses SOME of these differences. You probably don't need to read this section, or even think about for most Ada programming. The principle of least surprise that was used in developing these rules make it unlikely that a programmer will ever run into a case where the rules don't match his or her expectations. But langauge-lawyers and compiler developers need to pay close attention to this section and others. I have seen several posts that confused these rules badly. (In both senses of the word confused.) Note that 10.1.6(2) gives the visibility rules within use clauses, and 10.1.6(3) the visibility rules within pragmas and use clauses in context clauses. They are different. They have to be different. There are lots of with and use clauses where a "with and use" construct could be made to work--and most programmers would be happy with such a construct having 10.1.6(2) type visibility. But there are lots of existing pragmas and use clauses in existing code that depend on 10.1.6(3) type visibility and I see no justification for breaking all that code. For example I have some code that says: with Float_Complex; use type Float_Complex.Complex; -- Robert I. Eachus 100% Ada, no bugs--the only way to create software.