comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada and Design By Contract
Date: Wed, 26 Mar 2003 13:00:41 -0600
Date: 2003-03-26T13:00:41-06:00	[thread overview]
Message-ID: <v83u5jcss2frb8@corp.supernews.com> (raw)
In-Reply-To: 3E817504.5040806@praxis-cs.co.uk

Peter Amey wrote in message <3E817504.5040806@praxis-cs.co.uk>...
>> The check is made in the body of Q.SomeOperations. Why should
>> P.IsFull visible here?
>
>Because it is too late to wait until Q.SomeOperation is executed in
>breach of contract.  The real cause of the contract failure is
>AnotherOperation's attempt to call Q.SOmeOtherOperation in a way that
>will cause the stack to overflow.  If we want to try and deal with the
>problem we need to know where the dangerous condition started.   In our
>view this is better done by proof than by dynamic checks.


Which is why Janus/Ada was always included a call walkback with every
unhandled exception, and includes this information in
Exception_Information. It's often the case that the location of an
exception being raised (assertion failure) isn't enough information.
But, usually (probably more than 90% of the time), knowing the caller(s)
allow tracing/fixing the bug without having to add additional code (or
even run the program again).

Proof has its place, of course, but I don't think that most systems can
justify the extra work to develop that way. A few carefully placed
run-time assertions (combined with good compiler suppprt - it's not
surprising that Gnat added a walkback feature) are sufficient for
non-critical systems.

               Randy.





  reply	other threads:[~2003-03-26 19:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-23 18:55 Ada and Design By Contract Volkert
2003-03-24  9:41 ` Lutz Donnerhacke
2003-03-24 10:56 ` Peter Amey
2003-03-24 17:40   ` Volkert
2003-03-24 20:11     ` Lutz Donnerhacke
2003-03-25  8:04       ` Volkert
2003-03-25  8:25     ` Peter Amey
2003-03-25  9:55       ` Colin Paul Gloster
2003-03-25 10:09         ` Peter Amey
2003-03-26  9:00       ` Volkert
2003-03-26  9:00       ` Volkert
2003-03-26  9:38         ` Peter Amey
2003-03-26 19:00           ` Randy Brukardt [this message]
2003-03-26 19:32           ` Jeffrey Carter
2003-03-27  6:59             ` Volkert
2003-03-25 10:44 ` 
replies disabled

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