From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: On pragma Precondition etc.
Date: Tue, 29 Jul 2008 13:18:37 +0200
Date: 2008-07-29T13:18:37+02:00 [thread overview]
Message-ID: <488efc8d$1@news.post.ch> (raw)
In-Reply-To: <6etsi6F8mbmbU2@mid.individual.net>
Alex R. Mosteo schrieb:
> Piling more suggestions: I understand the point of using pragmas by Gnat at
> this stage, but if this is going to be standardized perhaps the syntax of a
> declaration could be changed. For example:
>
> function Foo (X, Y : Something) return Whatever with
> Precondition (Blah) and
> Postcondition (Urgh);
It too think a dedicated syntax would be best. However, I suggest to
take a good look at task and protected types for guidance.
Protected types already have an precondition. I know they are attached
to the body and a protected type blocks until the condition becomes true.
But the idea behind is still similar and so should be the syntax. Now
let me think:
Option 1:
using when - just like protected types.
function Foo (
Integer X,Y)
entry when
X > Y
exit when
Foo > X + Y
return
Integer;
Option 2:
using nicer English.
function Foo (
Integer X,Y)
on entry
X > Y
on exit
Foo > X + Y
return
Integer;
Both options would not need new keywords ;-)
And how about Invariants (http://en.wikipedia.org/wiki/Class_invariant)?
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
next prev parent reply other threads:[~2008-07-29 11:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 8:01 On pragma Precondition etc Georg Bauhaus
2008-07-25 10:50 ` stefan-lucks
2008-07-25 11:05 ` mockturtle
2008-07-25 11:44 ` Alex R. Mosteo
2008-07-25 11:56 ` Georg Bauhaus
2008-07-28 8:02 ` Alex R. Mosteo
2008-07-29 11:18 ` Martin Krischik [this message]
2008-07-29 12:08 ` Dmitry A. Kazakov
2008-07-29 14:19 ` Georg Bauhaus
2008-07-29 14:49 ` Georg Bauhaus
2008-07-29 15:00 ` Dmitry A. Kazakov
2008-07-29 15:14 ` Georg Bauhaus
2008-07-29 15:55 ` Georg Bauhaus
2008-07-29 17:49 ` Dmitry A. Kazakov
2008-07-30 9:06 ` Georg Bauhaus
2008-07-30 13:47 ` Dmitry A. Kazakov
2008-07-30 17:45 ` Georg Bauhaus
2008-07-31 8:12 ` Dmitry A. Kazakov
2008-07-31 23:06 ` Georg Bauhaus
2008-08-01 8:40 ` Dmitry A. Kazakov
2008-07-30 9:22 ` Georg Bauhaus
2008-07-30 13:56 ` Dmitry A. Kazakov
2008-07-25 14:39 ` Robert A Duff
2008-07-25 16:50 ` Pascal Obry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox