comp.lang.ada
 help / color / mirror / Atom feed
From: Joachim Durchholz <joachim.durchholz@munich.netsurf.de>
Subject: Enforcing assertions in Eiffel
Date: 1997/09/17
Date: 1997-09-17T00:00:00+00:00	[thread overview]
Message-ID: <34201D40.CF490EC0@munich.netsurf.de> (raw)
In-Reply-To: 341fddde.0@news.uni-ulm.de


Joerg Rodemann wrote:
> 
> Well, sorry to raise this topic again, we had a long discussion about
> that
> shortly and it's still continuing, but this seems to point to some
> problems
> we discussed in a concrete situation: 

Well, no - I can't imagine what the GPL (a *legal* contract) has to do
with Eiffel assertions (a *technical* contract).

> how is the Eiffel system going
> to check
> the usage of a class versus its specification (seems we agreed on the
> term
> short-flat form as a similar concept to the Ada spec.) Is the Eiffel
> system
> able to check against the compiled library or is it more likely to
> leave that
> to the linker as in C++?

Eiffel assertions are predicates, which in the language context means
boolean expressions. If the proper options are set at compile time these
expressions will be evaluated at the appropriate time; a violated
assertion will raise an exception.
Needless to say that these exceptions shouldn't be called to "fix things
up" in any way - what should be fixed is the code, not the execution. Of
course such an exception might still be caught to prevent disaster, e.g.
in an embedded system to safely shut down the machine or to fall back to
some panic mode of operation, or in an interactive system to report the
error and ask the user to try something different.

One important side note: You can compile each class with its individual
level of assertion checking (preconditions, postconditions, invariants,
and a few other assertion types not relevant on the interface level).
However, precondition checks are done in the caller (at least
conceptually), so even if you use a library compiled with all checks
off, you can still run your code with precondition checking on and
you'll get exceptions if you call that library with (say) wrong
parameters.

Regards,
Joachim
-- 
Please don't send unsolicited ads.






  reply	other threads:[~1997-09-17  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-13  0:00 New copying license for classes/modules: CGPL Wouter Scholten
1997-09-14  0:00 ` Robert Dewar
1997-09-16  0:00   ` Bertrand Meyer
1997-09-17  0:00     ` Joerg Rodemann
1997-09-17  0:00       ` Joachim Durchholz [this message]
1997-09-29  0:00         ` Enforcing assertions in Eiffel Joerg Rodemann
1997-09-30  0:00           ` Joachim Durchholz
1997-10-01  0:00             ` Jon S Anthony
1997-10-09  0:00               ` JOVIAL (J3) John R. Fluharty, Jr
1997-10-01  0:00           ` Enforcing assertions in Eiffel Morgan Palaeo Associates
1997-10-01  0:00             ` Joerg Rodemann
1997-10-01  0:00               ` W. Wesley Groleau x4923
1997-09-17  0:00     ` New copying license for classes/modules: CGPL Robert Dewar
1997-09-17  0:00     ` Robert Dewar
replies disabled

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