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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3dbf2f325f33ce35 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Elimination of "use" clauses Date: 1999/07/09 Message-ID: <7m3foq$nuj@dfw-ixnews14.ix.netcom.com>#1/1 X-Deja-AN: 498899220 References: <377B5807.88B875E0@cs.york.ac.uk> <7lh74s$v36$1@nnrp1.deja.com> <377CE178.6C15F543@hso.link.com> <7ljbsu$ni7$1@nnrp1.deja.com> <7ltl2q$mog$1@nnrp1.deja.com> <3784DC54.6463EDCA@decada.zko.dec.com> Organization: Netcom X-NETCOM-Date: Thu Jul 08 7:29:14 PM CDT 1999 X-Inktomi-Trace: sji-ca-cache 931480129 15730 209.111.212.57 (9 Jul 1999 00:28:49 GMT) Newsgroups: comp.lang.ada Date: 1999-07-08T19:29:14-05:00 List-Id: In article <3784DC54.6463EDCA@decada.zko.dec.com>, "Michael F. Yoder" wrote: >Not a strawman. The best ways of dealing with use clauses are what I >call "Tony Tye" methods (since he devised the first one I used) and make >package renamings a staple. This is a widely used technique. It does not completely solve the use clause question. What problem are we trying to solve? Ada is unique in its separation of scope from visibility. In any other language we would not even be discussing this issue. As noted earlier, the rules of Ada are analogous to default insulation on every entity. With most languages we have code that is the equivalent of bare wires running all over the place. Cavalier coding of the use clause is the same as removing all that nice insulation. Ada permits us to remove the insulation at appropriate places. We would never expect a consumer to go around scraping insulation from electrical wires in the home. We should not expect clients of packages to do the same. Instead, we should carefully expose, in our package design, those places where entities can safely connect with each other. This is a key difference between engineering and programming. The use clause, when invoked willy-nilly, exposes too much of the bare wire. The use type is not much better, but one can see its usefulness in teaching environments. At the same time, excessive paranoia over the use clause is usually unwarranted. In my earlier posting on this topic I said that the designer, not the client/consumer, should be responsible for deciding what should be exposed and what should be hidden. That is the purpose of creating restricted operator packages that can be referenced via the use clause. If a package is properly designed, the use clause applied to the restricted set of operators will be both easier to "use" and safer than many of the alternatives. We as designers need to take responsibility for this. Admittedly, most Ada packages in the existing software repositories have fallen short in addressing this issue. We can correct this in future designs. Richard Riehle richard@adaworks.com http://www.adaworks.com