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,52fd60a337c05842 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-17 13:06:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3D0E4184.4070207@attbi.com> From: "Robert I. Eachus" Organization: Eachus Associates User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020314 Netscape6/6.2.2 X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: The 1980 ACM Turing Award Lecture The Emperor's Old Clothes References: <3D0B813A.3040204@attbi.com> <3D0BEF81.8010704@mail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.61.239.24 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1024344379 24.61.239.24 (Mon, 17 Jun 2002 20:06:19 GMT) NNTP-Posting-Date: Mon, 17 Jun 2002 20:06:19 GMT Date: Mon, 17 Jun 2002 20:06:19 GMT Xref: archiver1.google.com comp.lang.ada:26177 Date: 2002-06-17T20:06:19+00:00 List-Id: Hyman Rosen wrote: > Really? I find this utterly astonishing. So almost every Ada program is > littered with error handling code interpenetrating the normal working > logic? > Or do Ada programs ignore eror codes just like old C programs did? No. Input output routines may need to do error checking, but that is not an exceptional occurrence, and is usually not treated as one. The 'Valid attribute in Ada 95 is a great enhancement to the language. It makes validity checking for input much easier to do, and to do in the right way. Most other cases where return values should be checked in C and are not, in Ada the checking is done by constraints on parameters well before the call. If your code can cause one of those constraint checks to fail, it may be that you need to rethink what you are doing. This propagation of validity in Ada means that putting constraints on values (and running with constraint checks turned on) can be faster in Ada than eliminating constraint checks. As a sort of trivial example: function Square_Root(X: in Natural) return Natural; ..does not need to do any internal checks, and will never raise an exception. (With the possible exception of Storage_Error...) Similarly, a procedure declared: procedure Foo(S: in out String); -- will never cause a buffer overrun. Of course, sometimes you need to use Ada.Strings.Bounded or Ada.Strings.Unbounded to get the correct semantic behavior. But that is just an instance of a general Ada rule. Using strong typing right eliminates a lot of errors, whether they are coding errors, compiler error messages, or potential exceptions. I hope this is all preaching to the choir, but I fell this thread contains too much self-flagellation as it is, and some balance is needed.