comp.lang.ada
 help / color / mirror / Atom feed
From: Anonymous Coward <spam@spam.com>
Subject: Re: Don't use the "use" clause
Date: Sun, 20 Nov 2005 03:57:57 GMT
Date: 2005-11-20T03:57:57+00:00	[thread overview]
Message-ID: <slrndo045v.1r7.bogus_addy@tango.mindfuq.org> (raw)
In-Reply-To: uwtj4xc6j.fsf@acm.org

In article <uwtj4xc6j.fsf@acm.org>, Stephen Leake wrote:
> 
> Hmm. Even for operators?
> 
> A := B + C; 
> 
> should work when A, B, C are Cartesian Vectors, not just scalars.
>
> And a use clause in a small function can easily improve readability.

That's what the "use type" clause is for.  I have no objection to the
use type clauses.  I use them myself, and coding standards always
accommodate them.

>> I don't only oppose it because of the ambiguity, but even when there
>> is no ambiguity, it's a severe inconvenience to have to grep a large
>> tree to hunt down a declaration.  
> 
> As others have said, get a real editor.

The version of emacs they've installed at work does not have this
capability, and I'm stuck with what they provide; but it wouldn't
matter anyway.  Even with that feature (which I've had on previous
projects), it wouldn't be worth it to constantly search like that,
when disciplined Ada programmers can simply follow the coding standard
and fully qualify external identifiers.

As a beginner I was tempted to use the use, but after I was forced to
fully qualify, I've discovered that it's much easier to read code from
others as well as old code of my own.  I would never go back, even if
Emacs had a mouseover cross reference.

>> Clearly the typing time saved by the use clause cannot possibly
>> offset the time lost on all the resulting code searches.
> 
> It's not the time typing I'm worried about, it's the time reading
> and understanding.

In that case the time you're worried about is what's reduced by fully
qualifying your names.  If you get the information as fast as you can
read it, you know what's going on faster than you can even reach for
your mouse.  You just cannot beat instantaneously knowing which names
are internal and which are not, and where they come from.

There is one case where I might be willing to tolerate the use clause
on a project.  If an editor existed that would fully qualify the names
(inline) as it loads the buffer so I wouldn't even need to hover over
them with a mouse, and the project supported such a tool, then it
wouldn't matter to me either way whether I had to read code that used
use clauses.  AFAIK, no such tool exists, or at least it's certainly
not mainstream.

A better approach would be to have the controlled code checked in
without use clauses, and if some hacker wants the package names
hidden, or other hidden information for that matter, then it would be
easier to make that a check out for browse option.

At one point I worked on a project that did not enforce their
prohibition on the use clause.  They simultaneously mandated a lousy
Windows-based tool set, which did not have cross referencing, and to
worsen things, grep was not provided either.  So we had to search
using the crappy native Microsoft search tool, which does not support
regular expressions.  The folks on that project who used use clauses
needlessly robbed me of copious manhours.



  reply	other threads:[~2005-11-20  3:57 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
2005-11-20 19:50                       ` Jeffrey R. Carter
2005-11-20  2:53                     ` Stephen Leake
2005-11-20  3:57                       ` Anonymous Coward [this message]
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