From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,df055ffdd469757d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.98.103 with SMTP id eh7mr1318911wib.3.1361006899871; Sat, 16 Feb 2013 01:28:19 -0800 (PST) Path: bp2ni40315wib.1!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!eu.feeder.erje.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Class wide preconditions: error in GNAT implementation? Date: Sat, 16 Feb 2013 10:28:10 +0100 Organization: cbb software GmbH Message-ID: <16s3mt7cm3n61$.8qu6fp1nglfq.dlg@40tude.net> References: <30edd381-7505-496a-99e5-f884faf33c33@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: TNGw0NoNrWqwYmfxAaSXHQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-02-16T10:28:10+01:00 List-Id: 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