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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to get nice with GNAT? Date: Thu, 27 Nov 2014 09:52:36 +0100 Organization: cbb software GmbH Message-ID: <1unjalvkasftw$.x2pts42ho7en$.dlg@40tude.net> References: <969708583438656051.436159nonlegitur-futureapps.invalid@reader80.eternal-september.org> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: laNruIVATSkD3QNnxceKvQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:191064 Date: 2014-11-27T09:52:36+01:00 List-Id: On Wed, 26 Nov 2014 15:27:35 -0600, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:g70ue0kjz9qi$.1b2fj6sqtjbez$.dlg@40tude.net... > ... >> If exceptions were under a contract, the list of possible exceptions to >> catch would be definite and quite small in most cases. So, actually, we >> could disallow "when others" for all subprograms having an exception >> contract and calling only such subprograms (statically). > > The practical problem with exception contracts is that they encourage people > (especially coders rather than engineers) to "eat" exceptions rather than to > figure out what ought to be done with them (or better yet, redoing the > code/preconditions/predicates so they can't arise). That's the practical > experience with them in Java, and that has caused some ARG members to be > rather strongly against them. (Which is why they didn't make it into Ada > 2012.) Right, but only if you require all subprograms to have contracts. Why should we? We couldn't anyway because it would break backward compatibility. Thus, IMO, there is nothing to worry about here. > I personally find that misguided (because Ada is for engineers, not coders), > and I'll try again with them the next Ada amendment. Good > BTW, that's a problem with all statically cateogorization contracts. We're > looking at a potentially blocking cateogorization as part of the > parallelization effort. What happens there is that calling any routine that > is potentially blocking is illegal inside of a routine that is declared as > non-blocking. (And unlike exception contracts, there's no workaround). The > effect is that one has to change the status of lots of routines in order to > use the categorization. Which is desired, isn't it? > (At least for this particular categorization, Ada > already says which language-defined routines are potentially blocking, so > it's just a matter of putting that into aspects and pragmas as needed - no > arguments about whether Sin should be potentially blocking :-) Conditionally blocking? Some predicates could depend (statically) on expressions. This is important for exceptions as well: generic with procedure Visitor (E : Element); procedure Iterate (X : Container); If Visitor is not contracted and Iterate is, then the contract of Iterate should be "I raise, what Visitor does". -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de