From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,db5c6b2ef47d4b9e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-21 07:28:15 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-04!supernews.com!cabal10.airnews.net!news.airnews.net!cabal11.airnews.net!news.airnews.net!news.cadence.com!not-for-mail From: Paul Graham Newsgroups: comp.lang.ada Subject: Re: short-circuit control forms (& 'long names are doom') Date: Thu, 21 Jun 2001 10:24:13 -0400 Organization: Cadence Design Systems Message-ID: <3B32038D.F1296C79@cadence.com> References: <3B30F836.D700DAA3@raytheon.com> NNTP-Posting-Host: pgraham-dsl.cadence.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.76 [en] (X11; U; SunOS 5.5.1 sun4u) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:8969 Date: 2001-06-21T10:24:13-04:00 List-Id: "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