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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.2.39 with SMTP id 7mr27251232obr.45.1416948447449; Tue, 25 Nov 2014 12:47:27 -0800 (PST) X-Received: by 10.182.107.232 with SMTP id hf8mr20527obb.36.1416948447361; Tue, 25 Nov 2014 12:47:27 -0800 (PST) Path: border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!h15no375028igd.0!news-out.google.com!c9ni23868igv.0!nntp.google.com!h15no7619743igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 25 Nov 2014 12:47:26 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.125.244; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.125.244 References: <0d8452a9-68c9-4835-b6f3-17407132ca9f@googlegroups.com> <8194a204-7b15-463d-a2fd-4d3ba342fe97@googlegroups.com> <8f203a9a-6c7c-4614-bc7d-efa65bf10776@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5f4d89b9-c96a-4b8f-90d3-b941a7f3c352@googlegroups.com> Subject: Re: How to get nice with GNAT? From: brbarkstrom@gmail.com Injection-Date: Tue, 25 Nov 2014 20:47:27 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.giganews.com comp.lang.ada:191024 Date: 2014-11-25T12:47:26-08:00 List-Id: On Tuesday, November 25, 2014 2:18:21 PM UTC-5, G.B. wrote: > On 25.11.14 16:07, ake.ragnar.dahlgren wrote: > > Of course I always listen seriously to Jeff Carter but it's not obvious= to me that doing "C in Ada" is bad. If I remember correctly Google employe= es are recommended to avoid using exceptions when doing C++. The designers = of Google Go has gone great lengths to avoid the exception concept as much = as possible. In addition SPARK forbids usage of exceptions. >=20 > Tucker Taft, designer of both Ada 95 and ParaSail has not > put Ada's exceptions in his ParaSail language(*). The latter > language does presume a lot of checking at compile time, though, > of logical expressions etc.; all of this is almost entirely absent > from C programs. >=20 > That's not without consequences for a fair comparison. >=20 > Some static analyzers re-interpret the C language by adding > rules and information that is not present in either C programs > or in the C language. The interpretation may likely be what > the programmers would have intended, but still inference cannot > magically add all of the same logical information to a C program > that would be present in a ParaSail program. Moreover, a program's > meaning then begins to essentially depend on the QoI of a compiler, > not on the language or on your own expressions as a program's author. >=20 > As these and previous efforts both at language design and > at compiler technology will influence AdaCore, it seems likely > that Ada 2012's contracts can both reduce the need for checks > at run-time and add assurance based on real expressions, > while also improving diagnostic messages if provers look at > the assertions, the calls, and the implementations. >=20 > There are the beginnings specific mentions of exception > identifiers in post-conditions, IIUC. >=20 > Post =3D> that_will_be_true(...) or else raise ...; >=20 > ParaSail... > "eliminates run-time exception handling -- strong compile-time > checking of preconditions and support for parallel event-handling > provides a safer alternative;" >=20 > __ > (*)https://forge.open-do.org/plugins/moinmoin/parasail/ Thanks to the last two posters for clarifying the situation with references to documents I haven't consulted. For now, it looks like raising exceptions and using exception handlers is quite legal. In the code development I'm doing, these tools are helpful and fairly easy to understand. Personally, I don't like to have code that raises warnings. Thus, when using a local exception handler removes the two warnings that appear when there isn't a handler, I feel more confident that the code will work. Bruce B.