comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@earthlink.net>
Subject: Re: AdaYY; Assertions?
Date: Mon, 19 Mar 2001 21:02:44 GMT
Date: 2001-03-19T21:02:44+00:00	[thread overview]
Message-ID: <3AB673D0.C3813A70@earthlink.net> (raw)
In-Reply-To: wcczoeocf7w.fsf@world.std.com

Robert A Duff wrote:
 
> The "obvious" thing to do with a precondition failure in the Ada context
> is to raise an exception.  I have thought a lot about how to move this
> checking to compile time -- it's not easy.  The same comments apply to
> the run-time checks that already exist in Ada.

And for the same reason.  Requiring an assertion to be checked and raise
an exception is not problematical, and compilers can and should check as
many as possible at compile time, with warnings.

But in the general case, it is not only not possible to check all
interesting post conditions at compile time, it should be trivially
obvious that you can't always statically determine even that the post
condition will be reached.  (And not just in the case of the halting
problem. ;-)

So I certainly favor allowing more general conditions in assertions,
rather than trying to define a compile time checkable set.  And I think
that current compilers do a pretty good job.  For example, if you need
to assert that a number is even, "pramga Assert(N mod 2 = 0);"



  reply	other threads:[~2001-03-19 21:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-10 21:24 AdaYY; Assertions? Lao Xiao Hai
2001-03-11 10:44 ` Florian Weimer
2001-03-12 16:20 ` Tucker Taft
2001-03-12 18:09 ` Stephen Leake
2001-03-14 17:17   ` Lao Xiao Hai
2001-03-14 19:39     ` Robert A Duff
2001-03-19 21:02       ` Robert I. Eachus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-12 11:07 Christoph Grein
2001-03-13  4:55 ` Bryce Bardin
2001-03-13 11:23   ` Florian Weimer
2001-03-14 16:52   ` Lao Xiao Hai
replies disabled

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