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 X-Google-Thread: 103376,b78c363353551702 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.196.232 with SMTP id ip8mr17671330pbc.6.1340739842116; Tue, 26 Jun 2012 12:44:02 -0700 (PDT) Path: l9ni23064pbj.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: about the new Ada 2012 pre/post conditions Date: Tue, 26 Jun 2012 21:43:57 +0200 Organization: cbb software GmbH Message-ID: References: <1oih2rok18dmt.avbwrres5k12.dlg@40tude.net> <4fe59ea0$0$9502$9b4e6d93@newsspool1.arcor-online.net> <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> <4fe9bde5$0$6566$9b4e6d93@newsspool4.arcor-online.net> <4fe9e7c5$0$6567$9b4e6d93@newsspool4.arcor-online.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: q1gJPV1SC/KP9ydRbYoWiw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-06-26T21:43:57+02:00 List-Id: On Tue, 26 Jun 2012 18:48:05 +0200, Georg Bauhaus wrote: > On 26.06.12 16:45, Dmitry A. Kazakov wrote: >> On Tue, 26 Jun 2012 15:49:24 +0200, Georg Bauhaus wrote: >> >>> On 26.06.12 15:07, Dmitry A. Kazakov wrote: >>> >>>> They are contracts when checked statically and implementations when checked >>>> dynamically. >>> >>> What do pre/post implement, if so, in your view? >> >> if Pre(...) then >> >> if Post(...) then >> null; >> else >> raise Constraint_Error; >> end if; >> else >> raise Constraint_Error; >> end if; > > There is a different understanding of "implement". Pre/Post > do not implement anything essential. They implement raising exceptions. > is supposed to > implement something that essentially agrees with Pre/Post. Sure. Anything that follows "then" in any if-statement implements something in agreement with the condition tested by the statement. That is the nature of if-statements. >>>> Contract violation => terminate. Exceptional state => recover. >>> >>> How does a client do make the program recover if an exception >>> stands for "unforeseen"? >> >> How does a client recover if X contains 3 rather than 1? >> >> Answer: it recovers by continuing its program further. > > In a truly exceptional situation, as opposed to when there is > a catch-all "special value", there is no contract that could have > been violated, because the contract does not in any way cover the > situation There is no known good value contained in X, for example, > because there is no (practically) meaningful state. If program continues, it does to some state. > For this truly exceptional situation, which is necessarily > unforeseen (otherwise it could have been covered by the contract), An unforeseen situation cannot be tested for. You cannot evaluate a predicate P you don't know. Even a test for "others" is foreseen. Others is merely: Others = not (P1 or P2 or ... or Pn) "Go there, do not know where. Bring that, do not know what" -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de