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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,89cb2d7ffc7421c9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!204.71.34.3!newsfeed.cwix.com!newsswing.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ripple effect Date: 07 Sep 2006 14:18:49 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1157653129 767 192.74.137.71 (7 Sep 2006 18:18:49 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 7 Sep 2006 18:18:49 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news2.google.com comp.lang.ada:6506 Date: 2006-09-07T14:18:49-04:00 List-Id: "Jeffrey R. Carter" writes: > Robert A Duff wrote: > > I think I want something like Ada's "use". Pascal calls it "with" (for > > records, as opposed to packages). It has nasty Beaujolais-like effects, > > but that's not necessary. One of the brilliant things Ichbiah did was > > to eliminate Beaujolais effects. Well, almost -- Ada 9X finished the > > job. And Ichbiah didn't go far enough in that regard -- I would > > eliminate hiding entirely. > > OK. I'm leaning the other way. I suppose there are many other ways; I'm not sure which one you're leaning toward. ;-) Surely not to increase Beaujolais-like effects!? > Thanks for the description. Are you saying that only an open module can > be opened by a client, but clients can not open a module and treated > like a closed module? I'm not sure. The user can declare a module "open". If you say "use X", you get visibility on X (remember this is not Ada's "use"). If X is open, you also get (direct) visibility on the contents of X. The part I'm not sure about is whether to _also_ provide something like Ada's "use" clause, which allows clients of a non-open module to open it. It could work for records, too, like Pascal's "with" statement -- except that I would eliminate the nasty Beaujolais-like effects of Pascal. > > My thinking is that if B uses A in a visible way, C pretty-much has to > > know about A. E.g.: > > with A; > > package B is > > procedue Mumble(X: A.T); > > end B; > > If C uses B.Mumble, it most likely needs to declare objects of type > > A.T. > > C certainly knows about type A.T! So non-transitive with's cause a lot > > of clutter -- C needs to 'with' everything it uses, plus everything > > those things are (visibly) based on, transitively. So high-level > > packages tend to have so many with_clauses that nobody wants to read > > them, largely defeating the purpose. > > True, but we're talking about the case where B doesn't actually > reference A (the with of A is "otherwise unneeded"). I guess I'm confused as to what the issue is, then. If B doesn't reference A, then it shouldn't import it -- and the compiler should give a (suppressable) error. Suppressable because you might want unused imports temporarily during construction. Also, there are some cases where unused imports are needed. > > OTOH, if B uses A only for implementation, that's a different story. > > Then the import of A belongs on the body of B, and C shouldn't know > > about it. (My language doesn't have private parts.) > > Agreed. > > > By the way, the issue of bogus with_clauses is a real maintenance > > problem -- nobody ever deletes a with_clause, so they tend to > > accumulate. This problem is easily solved. The compiler should give an > > error message. An error that can be suppressed, so that you can > > temporarily have bogus with_clauses during development. That's > > essentially what GNAT does, with appropriate warning switches. > > My sediments exactly. In fact, I do delete unneeded withs when I find them. Sure, so do I, but they're hard to find by hand. Once when I turned on the GNAT warning for unused with's on a program of about 200,000 lines, I found hundreds and hundreds of them. - Bob