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,c2f62556e56c9683 X-Google-Attributes: gid103376,public From: Jeffrey Carter Subject: Re: 'with'ing and 'use'ing Date: 2000/02/29 Message-ID: <38BC2EB3.2639372B@acm.org>#1/1 X-Deja-AN: 591452898 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 951856700 192.88.94.254 (Tue, 29 Feb 2000 12:38:20 PST) Organization: EarthLink Network, Inc. MIME-Version: 1.0 NNTP-Posting-Date: Tue, 29 Feb 2000 12:38:20 PST Newsgroups: comp.lang.ada Date: 2000-02-29T00:00:00+00:00 List-Id: Roger Hoyle wrote: > > Hi, > > I'm just trying to clear something up in my head. > > I'm trying to interface with a lot [a *lot* :] of Ada95 code and the rest > 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) Whether using a package is a good thing depends solely on how easy it is for someone unfamiliar with the code to read or modify it. Some packages are designed to be used; see, for example, Ada.Strings.Unbounded. This package was designed to be used; the type is named Unbounded_String, and "Unbounded" shows up in many names (Null_Unbounded_String, To_Unbounded_String). This makes it easy to tell where things came from. Other packages are so common that it doesn't affect readability to use them; examples include Ada.Text_IO and Ada.Numerics.Elementary_Functions. If you see "Put_Line" or "Sqrt" in your code it's pretty obvious where they come from. Other packages are not designed to be used, or are designed not to be used. I tend to write data structure packages so that the code has declarations such as Frequency : Frequency_List.Handle; Pending : Event_Queue.Handle; These type names would be ambiguous without the dot notation if you used both packages, and since they both have "Get" operations, the code can be difficult to read. You probably shouldn't use these packages. Some people (and organizations) have strict "don't use" policies, while others use pretty much everything. I advocate pragmatism based on ease of reading and modifying the code. Jeff Carter