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,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!newsfeed.icl.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Structured exception information Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1168885771.30643.20.camel@localhost> <1168891576.30643.39.camel@localhost> <5NKdnTv2UZfVZTbYnZ2dnUVZ_vipnZ2d@megapath.net> <38z8yk9z1uxn$.1r6qpevwu2i7c.dlg@40tude.net> <1lpy2h06scx34.1i2k4dlbg0nfy.dlg@40tude.net> <%xErh.228837$aJ.94458@attbi_s21> Date: Fri, 19 Jan 2007 14:52:35 +0100 Message-ID: NNTP-Posting-Date: 19 Jan 2007 14:52:35 CET NNTP-Posting-Host: 273e57d2.newsspool2.arcor-online.net X-Trace: DXC=YE4YFn_e_0Po7BmQ3]lA9EHlD;3Ycb4Fo<]lROoRaFl8W>\BH3YbCJhc>HC>]JhDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgbIn@eSDQ8GCi X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8327 Date: 2007-01-19T14:52:35+01:00 List-Id: On Fri, 19 Jan 2007 01:34:35 -0600, Randy Brukardt wrote: > The other issue was what to do with preconditions for inherited routines. > They ought to compose somehow, but that got ugly in a hurry. [...] > The proposal we were working on had a way to get the original value of a > scalar parameter. Which meant they all had to copied on entrance - causing > extra overhead. And the inheritance, visibility, and side-effect issues are > still around. Inherited subprograms should take them as-is. When overridden, preconditions are weakened, postoconditions are strengthened. An override should add its precondition as a disjunctive term to the precondition of the subprogram being overridden one, and its postcondition as a conjunctive term. There shall be no side-effects for the same reasons why there shall be no exceptions. (:-)) For the same reason visibility is not an issue, everything is visible... OK, what about an alternative. Let's forget about preconditions, let's call it *constraint*. This is what Ada has since its beginning. What about allowing more generous constraint expressions put on the subtypes? It could have the desired effect, IMO. The "precondition" could be a constraint on the subtype of an in-parameter. The "postcondition" could be one on the subtype of an out-parameter. We could allow ad-hoc subtypes in subprogram signatures, for lazy guys... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de