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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public From: "W. Wesley Groleau x4923" Subject: Re: Precondition Checking For Ada 0X (Was: Separation of IF and Imp: process issue?) Date: 1997/09/15 Message-ID: <341D8B8D.7C9F@pseserv3.fw.hac.com>#1/1 X-Deja-AN: 272745673 Sender: usenet@most.fw.hac.com (News Administration) References: <33E9ADE9.4709@flash.net> <5upe9k$7he@newshub.atmnet.net> <5utag9$o6s@newshub.atmnet.net> <3416ad14.0@news.uni-ulm.de> <3416D889.4A6C@pseserv3.fw.hac.com> X-Nntp-Posting-Host: sparc02 Organization: Hughes Defense Communications Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-09-15T00:00:00+00:00 List-Id: Robert Dewar wrote: > Wes said > >I claimed before (perhaps wrongly) that adding assertions to Ada > >seemed fairly trivial, but even if correct, there is one aspect > >that would NOT be trivial. Since an Eiffel-style assertion is > >part of the contract, BUT it is executed when a routine is called, > >how can it be put in an Ada spec in a form that is compilable AND > >associated with a particular declaration? > > It seems pretty easy to devise a pragma that would have the desired effect, > for example something like: > > procedure x (a : integer; b : integer); > pragma Precondition (x, a = b + 17); Which, if I remember right (that was a long time ago), was what I suggested in the same post--only I bowed to the Eiffel jargon and called the pragma Require. It would be almost trivial (in spite of my apparent comment otherwise) to implement a feature that the above is identical in effect to putting pragam Assert (a = b + 17); at the beginning of the body. However, as with pragma Inline, it would have to apply to all overloadings of "X", and if it is allowed (as above) to reference X's parameters, there could be a significant ambiguity in (for example) the following case: procedure x (a : calendar.time; b : task_ID); procedure x (a : integer; b : integer); pragma Precondition (x, a = b + 17); -- ---------------------------------------------------------------------- Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA Senior Software Engineer - AFATDS Tool-smith Wanna-be wwgrol AT pseserv3.fw.hac.com Don't send advertisements to this domain unless asked! All disk space on fw.hac.com hosts belongs to either Hughes Defense Communications or the United States government. Using email to store YOUR advertising on them is trespassing! ----------------------------------------------------------------------