comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Don't use the "use" clause
Date: Sun, 20 Nov 2005 12:07:04 +0100
Date: 2005-11-20T12:07:02+01:00	[thread overview]
Message-ID: <1jmopc0bqnxw6$.gad3gye7lnjg$.dlg@40tude.net> (raw)
In-Reply-To: slrndnvl3m.1r7.bogus_addy@tango.mindfuq.org

On Sat, 19 Nov 2005 23:40:46 GMT, Anonymous Coward wrote:

> In article <1ef4kvy6kdkwz.oqmb8acj5joo.dlg@40tude.net>, 
> Dmitry A. Kazakov wrote:
>> 
>> No, name collisions better be prevented by making "use" illegal when
>> it hides anything.
> 
> The use clause is barred by coding standards for a good reason, and I
> don't think it's necessarily name collisions that drive this rule.

What else then?

> Programmers are forced to resolve name collisions, with or without the
> USE clause.

No. Don't refer to conflicting names and the compiler won't object. This is
IMO bad.

> The use clause is banned because it makes code unreadable
> and difficult to use.  As Joel Spolsky said, travel should be minimal
> when interpretting a line of code.  Fully qualified naming is a better
> style because you know immediately, from the code itself, where the
> identifier lives.  And if you need to see the declaration, you know
> immediately where to go.

How so? Why should I care about the declaration/definition places? What
should be a fully qualified name of a dispatching call to a 10-times
overridden primitive operation, provided that 5 of them were private? The
first, the last, one in the middle?

>> BTW, what about banning implicit "use" of "Standard"? Care to write
>> an AI to make Integer, "+", "-" etc invisible? (:-))
> 
> The "use type" clause is a different beast, and I do not object to its
> use; nor is it banned in any coding standard I've read.

What is the difference between "+" and "Add"?

>>> Then to possibly get multiple hits and have to compare two lists of
>>> packages to discover which hit is the correct one.  By the time you
>>> make it to the declaration you're looking for, you've forgotten why
>>> you need to look at it :)
>> 
>> It is no matter "where", "what" does matter. If you need to
>> frequently browse sources to determine "what", then the program is
>> poorly designed.
> 
> Certainly not.  I would say just the opposit.  If you're repeating
> information from your declaration in your identifiers, then you've
> created a maintenance problem by introducing too much noise, also
> forcing identifiers to change whenever the declaration changes.  A
> good design doesn't repeat this information.

It seems that you are arguing my point. Name prefix is that noise you are
talking about.

>>> Clearly the typing time saved by the use clause cannot possibly offset
>>> the time lost on all the resulting code searches.
>> 
>> What about the time spent on reading something like A.B.C.D.E.F.G.H?
> 
> If you have something like that, then there's something wrong with the
> architecture of your project.  A user should not need visibility into
> such a deep level within an external component.

That might be true, but irrelevant because the implementation of H should
know A and A.B and A.B.C etc. According to your theory within H anything
from G must be referred as A.B.C.D.E.F.G.X!

Now if you aren't going to argue against child packages, consider "use A"
as an ad-hoc parent specification.

BTW, one probably could even remove "use" from the language allowing
multiple parents instead.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-11-20 11:07 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-15 16:03 Request for comments on simple Ada program Maciej Sobczak
2005-11-15 17:43 ` Samuel Tardieu
2005-11-15 17:47   ` Samuel Tardieu
2005-11-15 21:28   ` Jacob Sparre Andersen
2005-11-15 21:53     ` Samuel Tardieu
2005-11-16  9:10       ` Anders Wirzenius
2005-11-15 21:55     ` Samuel Tardieu
2005-11-16  9:03     ` Niklas Holsti
2005-11-16 14:21       ` Jacob Sparre Andersen
2005-11-16 17:08         ` Niklas Holsti
2005-11-16  7:11   ` Brian May
2005-11-15 18:29 ` jimmaureenrogers
2005-11-15 19:33   ` tmoran
2005-11-16 14:46     ` jimmaureenrogers
2005-11-16 18:05       ` Martin Dowie
2005-11-16 19:54       ` tmoran
2005-11-15 18:52 ` Martin Krischik
2005-11-15 19:33 ` tmoran
2005-11-16  3:10   ` Ada Quality and Style book discussion Anonymous Coward
2005-11-16  4:09     ` tmoran
2005-11-16  5:49     ` Simon Wright
2005-11-16  7:03       ` Martin Dowie
2005-11-17  4:49         ` Anonymous Coward
2005-11-17  6:48           ` Martin Dowie
2005-11-17 11:45           ` Georg Bauhaus
2005-11-17 12:37             ` Stephen Leake
2005-11-17 13:24               ` Georg Bauhaus
2005-11-17 23:15                 ` Stephen Leake
2005-11-19 20:28                   ` Don't use the "use" clause Anonymous Coward
2005-11-19 20:35                     ` Ed Falis
2005-11-21 17:36                       ` David Emery
2005-11-21 19:20                         ` Ed Falis
2005-11-21 22:21                           ` David Trudgett
2005-11-21 22:51                             ` Ed Falis
2005-11-22  0:15                           ` Anonymous Coward
2005-11-23  4:09                             ` Ed Falis
2005-11-23 19:26                               ` tmoran
2005-11-19 21:48                     ` Dmitry A. Kazakov
2005-11-19 22:33                       ` Simon Wright
2005-11-19 23:40                       ` Anonymous Coward
2005-11-20 11:07                         ` Dmitry A. Kazakov [this message]
2005-11-20 19:50                       ` Jeffrey R. Carter
2005-11-20  2:53                     ` Stephen Leake
2005-11-20  3:57                       ` Anonymous Coward
2005-11-20 10:44                     ` Pascal Obry
2005-11-20 19:48                     ` Jeffrey R. Carter
2005-11-22  5:11                     ` greptree lou
2005-11-22  6:08                       ` greptree Simon Wright
2005-11-25  1:00                       ` greptree Björn Persson
2006-01-23 12:51                     ` Don't use the "use" clause adaworks
2006-01-23 20:21                       ` Jeffrey R. Carter
2006-01-24  2:27                         ` Stephen Leake
2006-01-24  3:32                           ` Ed Falis
2006-01-24  4:44                           ` Jeffrey R. Carter
2006-01-24 22:53                             ` Stephen Leake
2006-01-24  8:54                           ` Dmitry A. Kazakov
2006-01-24  9:48                             ` Martin Dowie
2006-01-24 10:28                               ` Dmitry A. Kazakov
2006-01-24 13:30                                 ` brian.b.mcguinness
2006-01-24 20:03                                   ` Simon Wright
2006-01-24 23:00                                   ` Stephen Leake
2006-01-25  4:58                                     ` Jeffrey R. Carter
2006-01-24 23:38                                 ` Randy Brukardt
2006-01-25 14:49                                   ` Dmitry A. Kazakov
2006-01-25 21:46                                     ` Randy Brukardt
2006-01-26  9:14                                       ` Dmitry A. Kazakov
2006-01-27  1:04                                         ` Randy Brukardt
2006-01-27 15:23                                           ` Dmitry A. Kazakov
2006-01-27 16:35                                             ` Georg Bauhaus
2006-01-27 23:09                                               ` Randy Brukardt
2006-01-27 23:18                                             ` Randy Brukardt
2006-01-28 10:41                                               ` Dmitry A. Kazakov
2006-01-24 22:55                             ` Stephen Leake
2006-01-24  9:42                           ` Martin Dowie
2006-01-24 23:02                             ` Stephen Leake
2006-01-25  9:14                               ` Martin Dowie
2006-01-25 11:01                             ` Peter Amey
2006-01-25 11:06                               ` Martin Dowie
2006-01-25 20:07                               ` Jeffrey R. Carter
2006-01-31  2:24                               ` Stephen Leake
2006-02-09  5:13                       ` Anonymous Coward
2005-11-17 20:55           ` Ada Quality and Style book discussion Simon Wright
2005-11-18  0:44             ` Larry Kilgallen
2005-11-19 20:56             ` Anonymous Coward
2005-11-19 22:41               ` Simon Wright
2005-11-20  0:03                 ` Anonymous Coward
2005-11-17  4:23       ` Ada Quality and Style book discussion ("_Type" suffix) Anonymous Coward
2005-11-17 10:51         ` Martin Dowie
2005-11-19 21:52           ` Anonymous Coward
2005-11-20 15:50             ` Martin Dowie
2005-11-17 11:34         ` Georg Bauhaus
2005-11-17 11:53           ` Martin Dowie
2005-11-17 13:26             ` Georg Bauhaus
2005-11-17 12:26           ` Brian May
2005-11-17 13:45             ` Martin Dowie
2005-11-17 14:22               ` Marc A. Criley
2005-11-17 14:50                 ` Martin Dowie
2005-11-18  3:04                 ` Brian May
2005-11-18  9:23                   ` Maciej Sobczak
2005-11-18 14:00                     ` Marc A. Criley
2005-11-18 11:48                   ` Java exception model. Was: " Peter C. Chapin
2005-11-18 13:18                     ` Dmitry A. Kazakov
2005-11-19 18:06                       ` Peter C. Chapin
2005-11-19 18:58                         ` Dmitry A. Kazakov
2005-11-21 22:38                           ` Brian May
2005-11-21 23:27                           ` Brian May
2005-11-18 22:33                   ` Simon Wright
2005-11-17 14:03             ` Hyman Rosen
2005-11-20 19:41         ` Jeffrey R. Carter
2005-11-20 20:43           ` Dmitry A. Kazakov
2005-11-21  0:00             ` Simon Wright
2005-11-16 13:51     ` Ada Quality and Style book discussion Marc A. Criley
replies disabled

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