comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada and software testing
Date: Wed, 14 Jul 2021 21:51:54 +0200	[thread overview]
Message-ID: <scnf8n$1lgd$1@gioia.aioe.org> (raw)
In-Reply-To: 87pmvky9lz.fsf@nightsong.com

On 2021-07-14 21:32, Paul Rubin wrote:

> I do have to say that errors thrown by runtime checks on range types are
> still program bugs,

No, it depends on the contract.

> in the sense that they are type errors,

A type error cannot happen at run-time per definition of strong typing. 
Constraint violation is not a type error.

> that in
> principle we should want to catch at compile time.

If you can. In reality it is impossible to enforce validity per type 
system, because such contracts are often not enforceable.

So the trick is to relax the contract by including exceptions, which is 
what Ada constrained subtypes do. But then Constraint_Error becomes a 
legal "value" function + would "return" on overflow.

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

  reply	other threads:[~2021-07-14 19:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12  0:49 Ada and software testing Paul Rubin
2021-07-12  8:40 ` Dmitry A. Kazakov
2021-07-14 19:56   ` Paul Rubin
2021-07-12 16:14 ` Gautier write-only address
2021-07-12 16:41   ` Dmitry A. Kazakov
2021-07-14 19:32   ` Paul Rubin
2021-07-14 19:51     ` Dmitry A. Kazakov [this message]
2021-07-14 20:02       ` Paul Rubin
2021-07-15  7:27         ` Dmitry A. Kazakov
2021-07-16 10:01 ` G.B.
2021-07-16 10:21   ` Paul Rubin
2021-07-28 15:28     ` Paul Butcher
replies disabled

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