comp.lang.ada
 help / color / mirror / Atom feed
From: Paul Graham <pgraham@cadence.com>
Subject: Re: short-circuit control forms (& 'long names are doom')
Date: Thu, 21 Jun 2001 10:24:13 -0400
Date: 2001-06-21T10:24:13-04:00	[thread overview]
Message-ID: <3B32038D.F1296C79@cadence.com> (raw)
In-Reply-To: 3B30F836.D700DAA3@raytheon.com

"James A. Krzyzanowski" wrote:
> 
> Looking for expert opinions...
> 
> We have a company standard which states:
> "standard => Use short-circuit control forms to specify the order of
>              conditions when the failure of one condition means that
>              the other condition will raise an exception.
>  guideline => Avoid short-circuit control forms otherwise."
> 

Looking at the GNAT 3.13p source code, I count about 5000 occurrences of
'and then' and only about 400 occurrences of 'and' not followed by
'then'.  (This count is very approximate.)  It seems that the GNAT
policy is to use 'and then' by default.

Regarding the 'long names are doom' thread, I also notice that GNAT
tends to use short names. For instance, rather than using Integer
everywhere, many modules use subtype 'int' (though this may be for C
compatibility).  Another example of short names is the use of 'N' and
'M', sometimes for Node_Id, sometimes as integers.  Another example is
the use of single letter loop indices.  There are about 1700 'for' loops
in the GNAT source code, about 1600 of which use single letter indices. 
There are also short routine names, such as 'Scan', which, had it been
written 15 years ago, would have been called
'Scan_For_Next_Token_In_Input_Stream'.  There are about 50 declarations
of functions and procedures with single-character names, about 50 with
two-character names, and almost 300 with three-character names (though
some of these are the three-character transcendental functions Sin, Cos,
etc.).  Of course, there are plenty of long identifiers in GNAT, but
clearly the project does not prohibit the use short names.

Paul



  parent reply	other threads:[~2001-06-21 14:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-20 19:23 short-circuit control forms James A. Krzyzanowski
2001-06-20 20:15 ` Ted Dennison
2001-06-20 20:47 ` Marin David Condic
2001-06-20 22:23 ` Jeffrey Carter
2001-06-21  0:45   ` Al Christians
2001-06-21 15:06     ` Wes Groleau
2001-06-21 15:46       ` Al Christians
2001-06-21 18:28         ` Wes Groleau
2001-06-21 18:51         ` Marin David Condic
2001-06-22 12:17           ` Marc A. Criley
2001-06-22 14:55             ` Marin David Condic
2001-06-22 20:58   ` Robert Dewar
2001-06-22 21:49     ` Ted Dennison
2001-06-22 22:58     ` Jeffrey Carter
2001-06-23  0:38       ` Larry Kilgallen
2001-06-23 17:34       ` Simon Wright
2001-06-26 15:48       ` Wes Groleau
2001-06-25 17:00     ` Wes Groleau
2001-06-21  0:13 ` Mark Lundquist
2001-06-21  0:55   ` Al Christians
2001-06-21 12:39   ` Larry Kilgallen
2001-06-21 15:02   ` Wes Groleau
2001-06-21 14:24 ` Paul Graham [this message]
2001-06-21 17:20   ` short-circuit control forms (& 'long names are doom') Warren W. Gay VE3WWG
2001-06-21 18:32     ` Wes Groleau
2001-06-21 23:18   ` Charles Hixson
2001-06-22  1:01     ` Larry Kilgallen
2001-06-22  3:10     ` DuckE
2001-06-22 15:46       ` Wes Groleau
2001-06-22 19:02         ` Ted Dennison
2001-06-22 19:16         ` Ted Dennison
2001-06-22 20:53         ` Robert Dewar
2001-06-22 20:43       ` Robert Dewar
2001-06-22 22:34         ` Jerry Petrey
2001-06-25 14:30         ` Marin David 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