comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <condicma@bogon.pwfl.com>
Subject: Re: Elimination of "use" clauses
Date: 1999/07/09
Date: 1999-07-09T00:00:00+00:00	[thread overview]
Message-ID: <3785F03D.3F5B3B44@pwfl.com> (raw)
In-Reply-To: 7m3foq$nuj@dfw-ixnews14.ix.netcom.com

Richard D Riehle wrote:
> 
> 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.
> 
I think I can agree that package designers can/should help make
decisions about what should be directly visible, via some version of the
_Ops package, but don't you think that a lot of visibility issues are
going to depend on the caller? I mean, when I buy a 100 feet of wire at
The Home Depot, I expect the *default* to be that it is insulated so
that I don't string it through my attic and produce hazards where I
least expect it. But with a trusty pair of wire dykes I expect to strip
& connect where my application demands.

I personally like to limit the "use" clause to the smallest scope
possible - If I'm using Ada.Strings.Unbounded somewhere in a package, I
may use explicit dotted notation on the parameters of the subprograms,
but within the subprogram itself, apply the "use" clause to eliminate
the clutter. The caller of my package then knows where to find the data
types for the parameters, but within the package we kind of assume that
someone will recognize "Move" and "To_String" as being operations from
A.S.U. But it was *my* decision about what is clear and what may be
obfuscated within the context of my application.

> 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.
> 
I think it tends to be a tempest in a teapot. In practice, I think
clarity is more a result of the talent of the programmer rather than the
language features. Someone who thinks, speaks and writes clearly is
likely to produce code that communicates its intentions clearly with or
without the use clause. I think the advantage of the use clause is more
one of protecting the namespace than one of clarity/obfuscation. If the
given caller has no ambiguities or collisions with the names of the
withed package, the use clause is probably not going to hurt the clarity
much. If there are collisions, then avoid the use clause. (Except for
infix operators! There's nothing uglier than seeing 'My_Package."<" (L,
R)' ;-)

In general, eschew obfuscation. :-)

MDC
-- 
Marin David Condic
Real Time & Embedded Systems, Propulsion Systems Analysis
United Technologies, Pratt & Whitney, Large Military Engines
M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600
***To reply, remove "bogon" from the domain name.***

Visit my web page at: http://www.mcondic.com/




  parent reply	other threads:[~1999-07-09  0:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-01  0:00 Elimination of "use" clauses Dr. Neil C. Audsley
1999-07-01  0:00 ` czgrr
1999-07-01  0:00   ` Ted Dennison
1999-07-02  0:00     ` czgrr
1999-07-02  0:00       ` Ted Dennison
1999-07-01  0:00 ` Samuel T. Harris
1999-07-01  0:00 ` Joe Wisniewski
1999-07-02  0:00 ` Robert Dewar
1999-07-02  0:00   ` Samuel T. Harris
1999-07-02  0:00     ` Robert Dewar
1999-07-08  0:00       ` R. Tim Coslet
1999-07-09  0:00         ` Robert Dewar
1999-07-09  0:00           ` tmoran
     [not found]       ` <7ltl2q$mog$1@nnrp1.deja.com>
1999-07-08  0:00         ` Michael F. Yoder
1999-07-09  0:00           ` Richard D Riehle
1999-07-09  0:00             ` Michael F. Yoder
1999-07-09  0:00             ` Marin David Condic [this message]
1999-07-09  0:00           ` Robert Dewar
1999-07-09  0:00             ` Michael F. Yoder
1999-07-14  0:00               ` Tucker Taft
1999-07-09  0:00             ` Dale Stanbrough
1999-07-12  0:00               ` Robert Dewar
1999-07-12  0:00                 ` Ted Dennison
1999-07-10  0:00             ` Simon Wright
1999-07-12  0:00               ` Robert Dewar
1999-07-02  0:00   ` Ted Dennison
1999-07-02  0:00     ` Robert Dewar
     [not found]       ` <7ltus1$ah1@dfw-ixnews19.ix.netcom.com>
1999-07-13  0:00         ` Robert A Duff
1999-07-18  0:00           ` Richard D Riehle
1999-07-18  0:00             ` Dale Stanbrough
1999-07-20  0:00               ` Richard D Riehle
1999-07-19  0:00                 ` Brian Rogoff
1999-07-20  0:00                   ` Robert Dewar
1999-07-20  0:00                     ` Brian Rogoff
1999-07-21  0:00                       ` Ted Dennison
1999-07-21  0:00                         ` Robert A Duff
1999-07-21  0:00                         ` Robert Dewar
1999-07-21  0:00                       ` Robert Dewar
1999-07-21  0:00                         ` Brian Rogoff
1999-07-22  0:00                           ` Robert Dewar
1999-07-22  0:00                             ` Brian Rogoff
1999-07-22  0:00                           ` Robert Dewar
1999-07-22  0:00                             ` Brian Rogoff
1999-07-21  0:00                     ` Robert A Duff
1999-07-21  0:00                       ` Michael F. Yoder
1999-07-21  0:00                         ` Robert A Duff
1999-07-23  0:00                 ` Tucker Taft
1999-08-03  0:00                   ` Richard D Riehle
1999-07-20  0:00               ` David Kristola
1999-07-18  0:00             ` jerry
1999-07-19  0:00               ` Vladimir Olensky
1999-07-20  0:00               ` Richard D Riehle
1999-07-20  0:00                 ` Opaque Types (was Elimination of "use" clauses) David C. Hoos, Sr.
1999-07-20  0:00                 ` Elimination of "use" clauses jerry
1999-07-19  0:00             ` Ted Dennison
1999-07-19  0:00               ` Tucker Taft
1999-07-19  0:00                 ` Ted Dennison
1999-07-02  0:00     ` Stephen Leake
1999-07-02  0:00     ` Ed Falis
1999-07-02  0:00   ` Ed Falis
1999-07-03  0:00     ` Joe Wisniewski
1999-07-03  0:00       ` Keith Thompson
1999-07-03  0:00       ` Ed Falis
1999-07-13  0:00     ` Peter Amey
replies disabled

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