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-18 09:02:02 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.news2me.com!arclight.uoregon.edu!newshub.sdsu.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: Tue, 18 Nov 2003 11:02:00 -0600 Date: Tue, 18 Nov 2003 12:01:59 -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: <3FB6513B.DA6E53CA@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-OhWCiwINUEUO/SgEZ0XjKYARVqehMZ8NQ+vjfNLtkV+n2inbfAM1taeTJf8ay4SuN3xCISsMkM5bD5R!jpTaEPmmqoy1YdbvK/3ndDC3ia5AqBzT0ZNIo5lP4Y4BFQcP0DoXhvx+Cvv19w== 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:2632 Date: 2003-11-18T12:01:59-05:00 List-Id: Russ wrote: > Not being an Ada programmer, I did not even know off the top of my > head that "with Foo.Bar" is illegal. I'm at work, and my Ada books are > at home, so let me ask a "newbie" question. Am I correct in assuming > that "use Foo.Bar" *must* be preceded by "with Foo"? More > specifically, am I correct in assuming that "use Foo." > *must* be preceded by "with Foo"? > > If so, then the solution seems trivial to me. Let any occurence of > "use Foo." in the context section imply "with Foo". That is, > for any "use" in the context section, simply take its argument and > strip off the first "." and anything that follows it, then use that as > the argument to the implied "with". Unfortunately, it is not that simple. You can with library units, and child packages are library units, while nested packages are not, so whether or not with Foo.Bar is legal in theory requires semantic analysis, and in practice requires searching the compilation environment. So when you say "with Ada.Text_IO; use Ada.Text_IO;" yes there is an (implied) with of Ada, but there is also a with of Ada.Text_IO; then the use clause currently ONLY applies to Ada.Text_IO, not to Ada. That is one of the differences I have been talking about. > If not, I guess I just made a fool of myself. Oh well. Just the opposite. Now you are beginning to participate in the real discussion of this issue. Personally, I don't even use a keyboard shortcut for the "with Ada.Text_IO; use Ada.Text_IO;" case. I type fast enough, and that is one of the cases where I often do have a use clause in the context clause. In fact, sometimes I get exactly that far then spend sometime thinking. Do I want to create a generic template now, or deal with this I/O package separately? Do I want this package to be the child of something, or standalone, etc. But if there is a problem here, what we need to understand is both what are we trying to fix--if anything--and what are the problems that a fix must avoid creating. For me, there are many packages that are descendents of Ada for which I almost automatically put a use clause in the context clause. (There are others, such as Ada.Strings.Bounded where the use clause has to be for the instance I create. Since I tend to instantiate them inside other library units, the use clause often can't go in the context clause.) But for library units not in Ada, I tend to avoid use clauses in context clauses. Add to that my typing speed, and as I said I don't have a problem with the current rules. Doesn't mean that others don't, and I certainly won't be opposed to an extension that has no significant drawbacks. I might feel that there are other problems that are more pressing--for example the issue of mutually dependent abstractions--but that is an issue of prioritization. -- Robert I. Eachus 100% Ada, no bugs--the only way to create software.