comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: AdaYY; Assertions?
Date: Wed, 14 Mar 2001 19:39:31 GMT
Date: 2001-03-14T19:39:31+00:00	[thread overview]
Message-ID: <wcczoeocf7w.fsf@world.std.com> (raw)
In-Reply-To: 3AAFA79A.66F86B99@ix.netcom.com

Lao Xiao Hai <laoxhai@ix.netcom.com> writes:

> Pre-conditions
> 
> These could be applied to a subprogram or a data type.

I don't understand what a precondition on a type would mean?
Perhaps you meant to say "invariant"?  IMHO, invariants should apply to
types and packages.

> I personally have a problem with the retry semantics, but it seems to be
> effective
> with Eiffel.  Not sure about all the implications for Ada.

I don't like the "retry" thing in Eiffel.  It's no better than a goto
statement.  In fact, it's the worst kind of goto, because it jumps
backwards into the code, rather unexpectedly.  And Meyer's arguments in
favor of retry, based on assertions and whatnot, don't hold water.

> I do believe that run-time is the wrong place to find a pre-condition
> error.   It is too
> late in the process.  However,  if the pre-condition error can be detected
> at run-time
> and corrective action other than an exception handler be taken, perhaps it
> has some
> virtue.

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.

> These should apply to the type/class.   Invariants should be inherited.
> Eiffel allows overriding of the
> invariant (they call it something else, but same general effect).

I don't recall any way to override an invariant in Eiffel.  The
invariant of the parent class is automatically "and"-ed to the new
invariant (as far as I remember).

- Bob



  reply	other threads:[~2001-03-14 19:39 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 [this message]
2001-03-19 21:02       ` Robert I. Eachus
  -- 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