comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: 'with'ing and 'use'ing
Date: 2000/02/29
Date: 2000-02-29T00:00:00+00:00	[thread overview]
Message-ID: <38BC2EB3.2639372B@acm.org> (raw)
In-Reply-To: yoxzosjx5o1.fsf@dymock.dra.hmg.gb

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




  parent reply	other threads:[~2000-02-29  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-29  0:00 'with'ing and 'use'ing Roger Hoyle
2000-02-29  0:00 ` David Starner
2000-02-29  0:00 ` Robert A Duff
2000-02-29  0:00   ` Ted Dennison
2000-03-01  0:00   ` Robert Dewar
2000-02-29  0:00 ` Ted Dennison
2000-03-01  0:00   ` Robert Dewar
2000-03-01  0:00     ` Ted Dennison
2000-03-01  0:00       ` Robert Dewar
2000-03-01  0:00         ` Ted Dennison
2000-03-01  0:00           ` Wes Groleau
2000-03-02  0:00             ` Robert Dewar
2000-02-29  0:00 ` xl
2000-02-29  0:00   ` Jeffrey Carter
2000-02-29  0:00     ` xl
2000-03-01  0:00   ` Roger Hoyle
2000-02-29  0:00 ` Jeffrey Carter [this message]
2000-02-29  0:00   ` Brian Rogoff
2000-03-01  0:00     ` Jean-Pierre Rosen
2000-03-02  0:00       ` Charles Hixson
2000-03-02  0:00         ` Robert A Duff
2000-03-02  0:00           ` Ted Dennison
2000-03-02  0:00             ` Charles Hixson
2000-03-02  0:00               ` David Starner
2000-03-03  0:00                 ` Ted Dennison
2000-03-07  0:00                   ` Nick Roberts
2000-03-03  0:00                 ` Jeff Carter
2000-03-03  0:00                   ` David Starner
2000-03-04  0:00                     ` Simon Wright
2000-03-03  0:00               ` Larry Kilgallen
2000-03-03  0:00               ` Marin D. Condic
2000-03-03  0:00                 ` Scott Ingram
2000-03-04  0:00                   ` Simon Wright
2000-03-04  0:00               ` Robert Dewar
2000-03-04  0:00                 ` Ehud Lamm
2000-03-06  0:00                 ` Charles Hixson
2000-03-06  0:00                   ` Robert Dewar
2000-03-03  0:00       ` Charles H. Sampson
2000-03-04  0:00         ` Jean-Pierre Rosen
2000-03-06  0:00         ` Ted Dennison
2000-03-06  0:00           ` Robert Dewar
2000-03-07  0:00             ` Ted Dennison
2000-03-08  0:00               ` Robert Dewar
2000-03-11  0:00                 ` Robert A Duff
2000-03-06  0:00           ` Charles H. Sampson
2000-03-07  0:00             ` Stuart Palin
2000-03-08  0:00               ` Robert Dewar
2000-03-09  0:00                 ` Stuart Palin
2000-03-06  0:00           ` Ted Dennison
2000-03-06  0:00             ` Robert A Duff
2000-03-06  0:00               ` tmoran
2000-03-06  0:00             ` Robert Dewar
2000-03-07  0:00               ` Ted Dennison
2000-03-07  0:00               ` Marin D. Condic
2000-03-07  0:00             ` Marin D. Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox