comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: On pragma Precondition etc.
Date: Fri, 25 Jul 2008 13:44:28 +0200
Date: 2008-07-25T13:44:28+02:00	[thread overview]
Message-ID: <6etsi6F8mbmbU2@mid.individual.net> (raw)
In-Reply-To: f9112d8f-1c5a-4533-88ed-b4c22d108ac8@q5g2000prf.googlegroups.com

mockturtle wrote:

> 
> 
> stefan-lu...@see-the.signature ha scritto:
> 
>> On Fri, 25 Jul 2008, Georg Bauhaus wrote:
>>
>> > We would have something like
>> >
>> >    function More(X, Y: Integer);
>> >    -- ...
>> >    pragma Precondition(More, X > 2 * Y);
>> >
>> >
>> >    function Less(X, Y: Integer);
>> >    -- ...
>> >    pragma Precondition(Less, X < 2 * Y);
>> >
>> > And now there is no doubt about the subprogram to which a
>> > Pre-/Postcondition belongs.  (A rule that a spec Pre-/Postcondition
>> > pragma must come right after its subprogram will establish
>> > consistency.)
>>
>> This seems to break with overloading of subprogram names. I seem to recall
>> that
>>   "pragma Inline(Foo)"
>> is asking to inlie *all* functions / procedures with the name "Foo". This
>> may be OK for inlining, but you definitively don't want to use the same
>> preconditions which happen to have the same way. Consider the following:
> 
> What about _allowing_ for the name of the procedure to appear in
> the pragma?  The true syntactic link would be given by the pragma
> position
> and the procedure name would act as a "double check" to be sure that
> things were not messed up.  Of course this does not save you if you
> permute the pragma of overloaded functions...
> 
> ---

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?



  reply	other threads:[~2008-07-25 11:44 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 [this message]
2008-07-25 11:56       ` Georg Bauhaus
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