From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Assertions in Ada
Date: 1997/08/31
Date: 1997-08-31T00:00:00+00:00 [thread overview]
Message-ID: <EFsnL6.BpC@world.std.com> (raw)
In-Reply-To: 34036C83.4AA6@ist.flinders.edu.au
(e-mailed and posted)
In article <34036C83.4AA6@ist.flinders.edu.au>,
Adrian P. Morgan <apmorgan@ist.flinders.edu.au> wrote:
>As an alternative to using a pragma as an assertion mechanism, would it
>be possible to add new attributes to subprograms such as 'Precondition?
Maybe, but it seems tricky. Preconditions normally reference the
subprogram's parameters, but those parameters aren't normally visible in
a following attribute_definition_clause. So you'd have to have special
visibility rules. Also, how would you do Eiffel's "old" feature, where
you can have a post-condition that asserts something like "X = old X + 1"?
>Then we could say,
>
>for P'Precondition use Boolean_Expression;
>for P'Postcondition use Boolean_Expression;
And something like "for My_Type'Invariant use ..."? Or should
invariants be attached to packages? Or both? IMHO Eiffel's invariants
are more important than pre- and post- conditions, because you can
simulate pre- and post- conditions with much less pain.
>for P'Time_Constraint use 3.0; -- alternative to select then abort
Putting timing constraints in assertions seems to open a can of worms.
- Bob
next prev parent reply other threads:[~1997-08-31 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-08-21 0:00 Assertions in Ada AdaWorks
1997-08-21 0:00 ` Tucker Taft
[not found] ` <JSA.97Aug21183650@alexandria.organon.com>
1997-08-21 0:00 ` Robert Dewar
1997-08-22 0:00 ` Tucker Taft
1997-08-23 0:00 ` Ken Garlington
1997-08-24 0:00 ` Brian Rogoff
[not found] ` <199708251351.PAA13197@basement.replay.com>
1997-08-25 0:00 ` Robert Dewar
1997-08-27 0:00 ` Adrian P. Morgan
1997-08-31 0:00 ` Robert A Duff [this message]
1997-08-21 0:00 ` Brian Rogoff
1997-08-22 0:00 ` Robert Dewar
1997-08-23 0:00 ` Ken Garlington
1997-08-24 0:00 ` Robert Dewar
-- strict thread matches above, loose matches on Subject: below --
1997-08-22 0:00 AdaWorks
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox