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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,39579ad87542da0e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 X-Received: by 10.180.109.111 with SMTP id hr15mr1647895wib.1.1368583963613; Tue, 14 May 2013 19:12:43 -0700 (PDT) Path: hg5ni110164wib.1!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.131.MISMATCH!xlned.com!feeder3.xlned.com!news.astraweb.com!border5.a.newsrouter.astraweb.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.stack.nl!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Seeking for papers about tagged types vs access to subprograms Date: Sun, 12 May 2013 08:25:33 +0200 Organization: Ada @ Home Message-ID: References: <19lrzzbgm77v6.1dzpgqckptaj6.dlg@40tude.net> <1bfhq7jo34xpi.p8n2vq6yjsea.dlg@40tude.net> <12gn9wvv1gwfk.10ikfju4rzmnj.dlg@40tude.net> <1oy5rmprgawqs.1jz36okze0xju$.dlg@40tude.net> <1q2ql1e4rcgko.diszzq1mhaq8$.dlg@40tude.net> <1msoad3apbkf.1optea1ujjydv.dlg@40tude.net> NNTP-Posting-Host: 2WDySVo3ljzMoJ+IkbOqwg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2013-05-12T08:25:33+02:00 List-Id: Le Sun, 12 May 2013 08:02:16 +0200, Dmitry A. Kazakov = a =C3=A9crit: >>> The condition is moved to the post-condition. E.g. >>> >>> # require X >=3D 0.0 >>> function sqrt (X : Float) return Float; >>> # ensure sqrt (X)**2 =3D X >>> >>> is replaced with >>> >>> # require true >>> function sqrt (X : Float) return Float; >>> # ensure sqrt (X)**2 =3D X or else Constraint_Error raised >> >> It seems to me that this replacement loses information (the info that= >> X is "supposed to be nonnegative"). > > # ensure > (X >=3D 0.0 and then sqrt (X)**2 =3D X) > or else > (X < 0.0 and then Constraint_Error raised) But what's the benefit of moving the precondition to the postcondition? = Or = more simply, why dropping the idea of precondition for sub=E2=80=91progr= am = declarations? Do you have to re=E2=80=91invent or re=E2=80=91derive the precondition a= t each call place, = from the postcondition? Isn't it kind of bloat? It makes more me feel like losing something than the opposite. And how d= o = you clearly connect valid invocations into sequence? You can't connect a= ny = more, the post condition of A to precondition of B (when B comes next to= = A), or else, less clearly. There may be an issue with separation of = concern here (the God postcondition?). I won't enjoy a variant of Ada = doing so. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity