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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c2f62556e56c9683 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: 'with'ing and 'use'ing Date: 2000/02/29 Message-ID: <89h5lh$70r$1@nnrp1.deja.com>#1/1 X-Deja-AN: 591408479 References: X-Http-Proxy: 1.0 x22.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Feb 29 19:11:48 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-02-29T00:00:00+00:00 List-Id: In article , rh@signal.dera.gov.uk (Roger Hoyle) wrote: > of the code has a policy of not 'use'ing other packages, just > 'with'ing them to force the full names of types & functions etc. As a > result, I'm adopting the same attitude. > > 1) Is this basically a good idea? It seems sensible to me, but then I > know little about Ada. (I'm asking about generally not 'use'ing > stuff, not specifically my current situation) That's a very contraversial issue (odds are, you've just unwittingly touched off another flamewar about it). Suffice it to say that many people (myself included) think that's the "right" way to do things. Many other people whose opinions I respect feel that's hogwash. The basic issue is how easy it is for a new reader (such as yourself) to figure out where routines and objects are declared. If you have source code analysis tools available that can easily find declarations in other source files for you whenever you need to know, then there's a good argument that "use"s are OK. If you have some routines for which it is obvious to any competent reader where the declarations are, then it could be argued that "use"s are OK. > 2) One of the packages defines a sub-package called Ops, which > contains the operators (=,/=,>=,<=) etc for some of the types in > the main package. The only way I seem to be able to get access to > these operators is to 'use' the package. Is this right, or am I > missing somehting? That's one of 2 idioms that were commonly used in Ada83 to gain visibility to operators. The other was to do a function rename for them somewhere in the scope you wanted to use them. In Ada 95 you don't really need to do either anymore. There is a "use type" clause that serves this purpose. Unlike the normal "use" clause, "use type" is not very contraversial. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.