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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!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: What about a Static_Assertion? Date: Tue, 23 Jul 2013 20:57:05 +0200 Organization: Ada @ Home Message-ID: References: <7thagxnbdrkc$.1byplk3eqgza4.dlg@40tude.net> NNTP-Posting-Host: isXxzoEpMdi8+8WFlqpEZw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2454 Xref: number.nntp.dca.giganews.com comp.lang.ada:182662 Date: 2013-07-23T20:57:05+02:00 List-Id: Le Tue, 23 Jul 2013 20:43:19 +0200, Dmitry A. Kazakov = a =C3=A9crit: > On Tue, 23 Jul 2013 20:07:54 +0200, Yannick Duch=C3=AAne (Hibou57) wro= te: > >> Don't you believe it would be great to have static assertion just lik= e = >> we >> have static predicates? > > What is the difference between assertion and precondition or invariant= ? > An assertion may applies to multiple things at a time. I like to see an = = assertion as hypothesis (and I prefer the hypothesis to be statically = checkable :-P ), and it is an hypothesis I may refer to from multiple = place in a package (although I may like to duplicate it in multiple case= ), = not from a single sub=E2=80=91program. Also, there is no distinction between private and public predicates, whi= le = a can put an assertions in a package body, which I will refer to, to = =E2=80=9Cprove=E2=80=9D the implementation is correct (at least free of = runtime errors), I = can't do the same with a predicate. For hypothesis used in the = implementation only, public sub=E2=80=91program predicates are not suita= ble. By the way, I don't believe assertions are seen as a deprecated feature,= = and that suggest from many one's eyes, it is indeed different and can't = be = replaced by the actual predicates. -- = =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