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!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s72.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ripple effect References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.176 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s72 1157492212 12.201.97.176 (Tue, 05 Sep 2006 21:36:52 GMT) NNTP-Posting-Date: Tue, 05 Sep 2006 21:36:52 GMT Date: Tue, 05 Sep 2006 21:36:52 GMT Xref: g2news2.google.com comp.lang.ada:6456 Date: 2006-09-05T21:36:52+00:00 List-Id: 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. > But I think perhaps the "use"-like thing belongs on the package, rather > than on the clients of the package, because the person who writes the > package needs to use naming conventions that make sense for use or > not-use. > > I've considered calling it "open" -- it opens up the scope for > visibility. An "open" module provides direct visibility of its contents > to clients. And perhaps an "open" statement in addition, to be used by > clients. 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? > 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"). > 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. -- Jeff Carter "There's no messiah here. There's a mess all right, but no messiah." Monty Python's Life of Brian 84