comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: On pragma Precondition etc.
Date: Fri, 25 Jul 2008 13:56:07 +0200
Date: 2008-07-25T13:56:07+02:00	[thread overview]
Message-ID: <4889bf57$0$9508$9b4e6d93@newsspool3.arcor-online.net> (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);
> 
> So now it is all a indivisible whole and the OP concern is gone.
> 
> I haven't seen Eiffel code. How do they do this?

feature Foo(X, Y : SOMETHING): WHATEVER is
		-- short comment
	require
		Precondition_Name: Blah
	do
		...
	ensure
		Postcondition_Name: Urgh
	end

The Pre-/Postcondition_Name serves a purpose similar to the
message parameter of Ada's pragmas.)

Eiffel's "contract view" of the class then hides the statements
of Foo. So you get a "spec".

feature Foo(X, Y : SOMETHING): WHATEVER is
		-- short comment
	require
		Precondition_Name: Blah
	ensure
		Postcondition_Name: Urgh


In addition, Eiffel's Pre-/Postcondition have inheritance rules
for the conditions.  Another spot where Ada would to be more
general.


--
Georg Bauhaus
Y A Time Drain  http://www.9toX.de



  reply	other threads:[~2008-07-25 11:56 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 [this message]
2008-07-28  8:02         ` Alex R. Mosteo
2008-07-29 11:18       ` Martin Krischik
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