comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Preconditions which anyway would be caught?
Date: Mon, 11 Aug 2014 09:31:07 +0200
Date: 2014-08-11T09:31:07+02:00	[thread overview]
Message-ID: <1b5ytxppxisxu$.nom2sfczulhi$.dlg@40tude.net> (raw)
In-Reply-To: HITFv.512020$Ro3.111072@fx13.iad

On Sun, 10 Aug 2014 18:00:36 -0600, Shark8 wrote:

> On 10-Aug-14 01:24, Dmitry A. Kazakov wrote:
>> Specifying precondition for the sake of having them is meaningless.
> 
> Not all preconditions imply a post-condition; sometimes it's simply to 
> constrain the values that you're willing to entertain;

All.

> for example if 
> you have Natural_Float being a subtype of float (range 0.0 .. 
> Float'Last) you could use this in an internal simple simulator with 
> Square_Root(X: Natural_Float) return Float being a function therein.

The precondition of Square_Root en-force is True, thus calling Square_Root
(-1.0) is not an error.

Constraints are "dynamic preconditions" in Ada 2012 Newspeak.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

      reply	other threads:[~2014-08-11  7:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 15:35 Preconditions which anyway would be caught? Victor Porton
2014-08-09 15:40 ` mockturtle
2014-08-09 16:08 ` Jeffrey Carter
2014-08-09 19:21 ` Peter Chapin
2014-08-09 19:24   ` Peter Chapin
2014-08-09 21:04     ` Niklas Holsti
2014-08-09 22:57       ` Peter Chapin
2014-08-10 20:58         ` Niklas Holsti
2014-08-10  7:24       ` Dmitry A. Kazakov
2014-08-11  0:00         ` Shark8
2014-08-11  7:31           ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox