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 X-Received: by 10.68.69.98 with SMTP id d2mr16031791pbu.0.1407598849751; Sat, 09 Aug 2014 08:40:49 -0700 (PDT) X-Received: by 10.140.102.104 with SMTP id v95mr44912qge.6.1407598849701; Sat, 09 Aug 2014 08:40:49 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!enother.net!enother.net!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!h18no10723907igc.0!news-out.google.com!j6ni34289qas.0!nntp.google.com!j15no5788079qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 9 Aug 2014 08:40:49 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.37.89.62; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 93.37.89.62 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <89bfed98-c656-45b5-b812-5fd9c7d5998e@googlegroups.com> Subject: Re: Preconditions which anyway would be caught? From: mockturtle Injection-Date: Sat, 09 Aug 2014 15:40:49 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 1928 X-Received-Body-CRC: 2969528823 Xref: news.eternal-september.org comp.lang.ada:21607 Date: 2014-08-09T08:40:49-07:00 List-Id: On Saturday, August 9, 2014 5:35:21 PM UTC+2, Victor Porton wrote: > function Inverse (X: Float) is >=20 > begin > return 1/X; > end > with Pre =3D> (X /=3D 0); >=20 > Is this precondition superfluous? (it anyway could be caught by erroneous= =20 > 1/X operation) Still not a LL... I would say it is not. It depends on the "reason" for sp= ecifying the precondition. As I see it, the precondition is a kind of "for= mal documentation" of the conditions that must be satisfied when you call t= he function. As a side effect, you can have those conditions checked at ru= n-time as a "bug trap," but, for example, they could be used by some formal= checking software. So, even if calling the function with X=3D0 will cause= an error, I would keep the precondition. Riccardo