comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Class wide preconditions: error in GNAT implementation?
Date: Sat, 16 Feb 2013 10:28:10 +0100
Date: 2013-02-16T10:28:10+01:00	[thread overview]
Message-ID: <16s3mt7cm3n61$.8qu6fp1nglfq.dlg@40tude.net> (raw)
In-Reply-To: 30edd381-7505-496a-99e5-f884faf33c33@googlegroups.com

On Fri, 15 Feb 2013 18:50:36 -0800 (PST), ytomino wrote:

> No. It's related to correctness.

Not when checked dynamically by the same program.

> Precondition is a promise for caller, not callee.

Actually it is imposed on both.

> In this case, the caller should keep As.foo'Pre'Class because calling As.foo.

No, the caller shall satisfy the precondition of the callee. Regarding
inheritance, a primitive operation (callee) may weaken the precondition it
overrides. This is why logical disjunction apply, as Randy said.
Considering individual terms of the disjunction, the caller is allowed to
satisfy at least one of them to make the call valid.

Note that if the callee were a class-wide operation then its precondition
would read literally.

P.S. To make the model working especially with multiple-dispatch, pre- and
post-conditions should be stated for individual arguments and the result(s)
rather than on the operation as a whole. The same operation could
(theoretically) be primitive and non-primitive in its different arguments.
The rule of weakening preconditions and strengthening post-conditions apply
per argument/result inheritance path.

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



  reply	other threads:[~2013-02-16  9:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15  3:55 Class wide preconditions: error in GNAT implementation? ytomino
2013-02-15 10:15 ` Georg Bauhaus
2013-02-15 13:16   ` ytomino
2013-02-16  1:01 ` Randy Brukardt
2013-02-16  2:50   ` ytomino
2013-02-16  9:28     ` Dmitry A. Kazakov [this message]
2013-02-16 13:13       ` ytomino
2013-02-16 16:35         ` Dmitry A. Kazakov
2013-02-16 19:55           ` ytomino
2013-02-16 20:34             ` ytomino
2013-02-18  8:30             ` Dmitry A. Kazakov
2013-02-18  9:17               ` Simon Wright
2013-02-18 14:25                 ` Dmitry A. Kazakov
2013-02-18 18:04                   ` Simon Wright
2013-02-18 19:27                     ` Dmitry A. Kazakov
2013-02-18 20:42                       ` Simon Wright
2013-02-19  9:07                         ` Dmitry A. Kazakov
2013-02-18 19:02               ` ytomino
2013-02-18 19:44                 ` Dmitry A. Kazakov
2013-02-16 15:16       ` Georg Bauhaus
2013-02-16 20:23   ` Simon Wright
2013-02-17 15:12     ` ytomino
2013-02-18 17:49       ` Simon Wright
2013-02-18 18:45         ` ytomino
replies disabled

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