comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: On pragma Precondition etc.
Date: Wed, 30 Jul 2008 15:47:30 +0200
Date: 2008-07-30T15:47:30+02:00	[thread overview]
Message-ID: <1lt840f6z5lva.8rilgn0ds47u$.dlg@40tude.net> (raw)
In-Reply-To: 48902f08$0$1064$9b4e6d93@newsspool3.arcor-online.net

On Wed, 30 Jul 2008 11:06:16 +0200, Georg Bauhaus wrote:

> Dmitry A. Kazakov schrieb:
>> On Tue, 29 Jul 2008 17:55:18 +0200, Georg Bauhaus wrote:
> 
>>> What if one precondition states a relation between two suprogram
>>> parameters, or between properties of two suprogram parameters?
>> 
>> This case is equivalent to full multiple dispatch. Ada does not have it. If
>> it had multiple dispatch then it would clearer how to deal with the
>> corresponding contracts (=conditions).
> 
> How about this: For the purpose of expressing the contract
> of a subprogram, dream up its "contract-type".

This type is obviously a tuple of the parameters of Foo.

> Base this type on
> 
> (1) the precursor's contract-type (up the derivation hierarchy)
> (2) the profile
> 
> So given
> 
>     function Foo(X, Y: Integer) return Whatever;
> 
> denote the precondition of its "contract-type" by something like
> 
>     Foo'Precondition;

Naming does not solve the problem.

In presence of:

   subtype My_Integer is Integer range 1..500;
   type My_Whatever is new Whatever with private;

what are the preconditions of Foo defined on the tuples:

Integer x My_Integer x Whatever
My_Integer x Integer x Whatever
Integer x My_Integer x Whatever
My_Integer x My_Integer x Whatever
Integer x My_Integer x My_Whatever
My_Integer x Integer x My_Whatever
Integer x My_Integer x My_Whatever
My_Integer x My_Integer x My_Whatever

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-07-30 13:47 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
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 [this message]
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