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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b78c363353551702 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.241.162 with SMTP id wj2mr12381158pbc.2.1341560479773; Fri, 06 Jul 2012 00:41:19 -0700 (PDT) Path: l9ni11004pbj.0!nntp.google.com!news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!78.46.240.70.MISMATCH!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 06 Jul 2012 09:41:18 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: about the new Ada 2012 pre/post conditions References: <1mkp7fzlk1b0y.1ueinfjn48fcy$.dlg@40tude.net> <4fe72b6b$0$9504$9b4e6d93@newsspool1.arcor-online.net> <1bbvp3ghpjb5s.1go1s1qvcmagh$.dlg@40tude.net> <4fe76fad$0$9507$9b4e6d93@newsspool1.arcor-online.net> <1jt8vhzxfrv2i.eohce4d3rwx1$.dlg@40tude.net> <4fe83aaa$0$6624$9b4e6d93@newsspool2.arcor-online.net> <1pkfv0tiod3rn$.onx6dmaa3if9$.dlg@40tude.net> <1i1mp8xs3vtl2.1oc4m66qtfgzq.dlg@40tude.net> <33crfw5vkxoh$.kz5mq75s36ee.dlg@40tude.net> <43e4637c-3337-4d99-be45-20e054e5a203@googlegroups.com> <6ua1uo9zmkjn$.1tmqyzmetx71u$.dlg@40tude.net> In-Reply-To: <6ua1uo9zmkjn$.1tmqyzmetx71u$.dlg@40tude.net> Message-ID: <4ff6969e$0$9514$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 06 Jul 2012 09:41:18 CEST NNTP-Posting-Host: e5eb3aaf.newsspool1.arcor-online.net X-Trace: DXC=gmHcFo]BNgWaoembcbF;DQic==]BZ:af^4Fo<]lROoRQnkgeX?EC@@PjD]=Ch2TYTRPCY\c7>ejVX9O]nZ9K^f@RFZ\7>B=E3OV X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Date: 2012-07-06T09:41:18+02:00 List-Id: On 05.07.12 21:55, Dmitry A. Kazakov wrote: > On Thu, 5 Jul 2012 12:11:57 -0700 (PDT), Adam Beneschan wrote: > >> On Thursday, July 5, 2012 12:48:30 AM UTC-7, Dmitry A. Kazakov wrote: >> >>> Putting it even simpler. What is the effect of: >>> >>> sqrt (-1.0) >>> >>> No effect? Any effect? >> >> This looks like an imaginary problem to me, not a real one. > > What problem? It was a simple question illustrating absurdity of the idea. Actually, a negative argument passed to sqrt is illustrating proper DbC well. One famous example is Ariane 4, (4), that's the number four. Another example is muffins, or meat balls. sqrt(r), r < 0 would corresponds to ariane-4-f(v), where not v'valid: since the engineers did well for Ariane 4, not v'valid would not happen, is always true. So they could make the software module efficient. > Since the effect is evidently Constraint_Error, then raising it is a > required part of the implementation. The proponents of DbC see the sqrt case differently, OOSC2 � 11.6(*): +--- | Non-Redundancy principle | | Under no circumstances shall the body of a routine ever test | for the routine's precondition. +--- where function sqrt (x: REAL) return REAL with Pre => x >= 0.0; That is, in a properly written system the author of the call of sqrt needs to ensure that x >= 0.0 because of his or her contractual obligation to do exactly this. The author of sqrt is right when he or she starts from the precondition as agreed between the two in contract: x >= 0.0 = True. For making muffins (or meat balls), when stirring is required, use a tool. The precondition for using the tool is that the dough be for muffins (or made of equally light ingredients for meat balls). Don't use the same tool with sour dough starter and rye flour. That's part of the contract. I'll not be surprised to learn the makers of kitchen machines have added corresponding preconditions in their manuals. __ (*) � 11.6. Coincidence? ;-) ;-)