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.50.197.134 with SMTP id iu6mr8728789igc.1.1341320024132; Tue, 03 Jul 2012 05:53:44 -0700 (PDT) Path: l9ni10736pbj.0!nntp.google.com!news2.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, 3 Jul 2012 14:53:51 +0200 Organization: cbb software GmbH Message-ID: References: <1jvy3elqtnd1j.1sjbk32evhp1f$.dlg@40tude.net> <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> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.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-07-03T14:53:51+02:00 List-Id: On Tue, 3 Jul 2012 00:28:31 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:xmybo646240w$.13rwa9qwsliyp$.dlg@40tude.net... >> On Tue, 26 Jun 2012 13:50:28 +0200, stefan-lucks@see-the.signature wrote: > ... >> They are contracts when checked statically and implementations when >> checked dynamically. > > No, they're always contracts. They certainly aren't "implementation", > because they do *not* belong to the subprogram; they're checked *before* the > subprogram is called. Checked by whom? How does this make any difference to the caller or to the program as a whole? Is there a way to determine whether an exception was raised in the body or "before" the body? Maybe there is some special before-the-body-exceptions, propagated in some special manner? It just does not make sense. The contract should refer to all effect of calling the program. > Besides, I don't understand why it is such a disaster to have precondition > contracts be dynamically evaluated in some cases, while it is OK to have a > postcondition be dynamically evaluated in some cases -- it too is a contract > (one that is evaluated *after* the subprogram finishes). It is *not* OK to evaluate precondition of a program by the program itself. It is similar to how halting becomes a problem: procedure P is begin while not HALT (P) loop null; end loop; end P; All this boils down to self-referential stuff. > (Don't use specific preconditions and > postconditions if you care about inheritance.) Which is a telling advise, taking into about that [true] pre-/post-conditions is all [true] interface is about. Inheritance at the interface level is nothing but shuffling pre-/post-conditions. >> Another necessary contract mechanism is composition. That is when you pass >> a downward closure to an operation, that could say: I raise what the >> argument does. Note that this will require proper procedural types to have >> interfaces to carry the contract with. E.g. you would be able to limit the >> closure operation to what it is allowed to raise. > > I agree with the need for composition; we had that in the never-finished > "global in/out" contracts. But that doesn't require "procedural types" > per-se; Propagation of target contracts trough access to the target looks much more complicated. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de