comp.lang.ada
 help / color / mirror / Atom feed
From: Wes Groleau <wesgroleau@spamcop.net>
Subject: Re: Assertions in the Next Ada Standard
Date: Fri, 11 Jan 2002 15:39:55 -0500
Date: 2002-01-11T15:39:55-05:00	[thread overview]
Message-ID: <3C3F4D9B.79019B90@spamcop.net> (raw)
In-Reply-To: 3C3F45EE.7030808@look.ca


>      declare
>          Const_X : constant Integer := X;
>          -- invariant X
>          Pos_Y : Positive := Y;
>          -- ensure Y > 0
>          -- invariant (Y > 0)
>      begin
>          loop
>              ...
>          end loop;
>      end;

The "ensure" works, but not the "invariants."  Neither of those
declarations prevents an assignment to X or Y.

I never saw the official proposal (if there was one) but
I'd think it should be inside a subprogram:

pragma Require   ( condition );
pragma Invariant ( condition );
pragma Ensure    ( condition );

or after a subprogram declaration:

pragma Require   ( subprogram, condition );
pragma Invariant ( subprogram, condition );
pragma Ensure    ( subprogram, condition );

Rules of scope could be based on those of Eiffel, unless Eiffel
experience has shown a need for modification.

Since they're pragmas, any vendor could try them out without
affecting validation.

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



  reply	other threads:[~2002-01-11 20:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11  6:20 Assertions in the Next Ada Standard Richard Riehle
2002-01-11  9:23 ` Dale Stanbrough
2002-01-11 13:47   ` Robert A Duff
2002-01-11 23:28   ` Nick Roberts
2002-01-12  1:30     ` Darren New
2002-01-11 20:07 ` FGD
2002-01-11 20:39   ` Wes Groleau [this message]
2002-01-12  4:56     ` Robert Dewar
2002-01-12  7:30   ` Richard Riehle
2002-01-12 19:58     ` FGD
2002-01-12 21:27       ` Ed Falis
2002-01-12 22:45     ` Darren New
2002-01-14 17:20       ` Robert A Duff
2002-01-14 17:42         ` Darren New
2002-01-14 23:16     ` Mark Lundquist
2002-01-17  6:23     ` Richard Riehle
replies disabled

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