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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada 2012 Constraints (WRT an Ada IR) Date: Tue, 06 Dec 2016 09:29:00 +0000 Organization: A noiseless patient Spider Message-ID: References: <03847fd7-5699-48de-bb3c-ef5512398f26@googlegroups.com> <3ef819e8-55f7-4ef7-9f37-77e6abc33f98@googlegroups.com> <47366b42-c0a3-41bf-a44a-5241c109d60f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="864bc9c0338a1658b2b7d47e9713a3a4"; logging-data="18557"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QD1cYLB2698R6ihS1wAy+dlGiESrqLH4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) Cancel-Lock: sha1:NOuVttpRuPh78hEMx1IsKliz3wA= sha1:PfDT8mzJMOvRPjSJHJ5tCQyr7kQ= Xref: news.eternal-september.org comp.lang.ada:32637 Date: 2016-12-06T09:29:00+00:00 List-Id: "Dmitry A. Kazakov" writes: > On 2016-12-05 23:12, Randy Brukardt wrote: >> "Dmitry A. Kazakov" wrote in message >> news:o23a8a$11e9$1@gioia.aioe.org... >> ... >>> Things called in Ada pre- and post-conditions if evaluated during >>> run-time are merely subprogram bodies booby-trapped with >>> unanticipated exceptions. Bad thing. >> >> Until you compare to the alternative, which is a subprogram body that >> gives the wrong answer without detection. As I said in another >> message, a visible bug is much better than an invisible bug. > > The alternative is a contract to raise exception. So there is no bug > anymore, just well-defined behavior. I'm sorry, but this argument is ridiculous. If I write the code to implement the required behaviour to the best of my ability, but get it wrong, then the code will not have the required behaviour and will not meet any contract that might be placed on it. The equivalent of your contract would be with Post => Correct_Behaviour_Implemented or else Something_Terrible_Occurs; which isn't worth saying.