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,61e9062c1f23b9d5 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!newsfeed-0.progon.net!progon.net!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: contracted exceptions 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: <1181165630.012508.55290@i38g2000prf.googlegroups.com> <19fxsxv1god43$.1pqq8vgfu2itn$.dlg@40tude.net> Date: Fri, 8 Jun 2007 14:08:05 +0200 Message-ID: NNTP-Posting-Date: 08 Jun 2007 14:05:35 CEST NNTP-Posting-Host: fb8c59d5.newsspool1.arcor-online.net X-Trace: DXC=_OWJmokn4geFXUDVUnEXQmic==]BZ:afn4Fo<]lROoRaFl8W>\BH3YbONH2D4jXJ0hDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgb;i`]4Y>9@Ka X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16106 Date: 2007-06-08T14:05:35+02:00 List-Id: On Fri, 08 Jun 2007 08:53:28 GMT, Ray Blaak wrote: > "Dmitry A. Kazakov" writes: >> On Thu, 7 Jun 2007 21:19:08 -0500, Randy Brukardt wrote: >> Shouldn't "contracted exceptions" actually mean statically contracted ones? >> IMO, a contract can be violated only by the [buggy] compiler. > > Some points: > > Even with a perfect compiler and runtime, one still has to be prepared to > handle unexpected errors due to the environment (e.g. someone yanks out the > network cable, etc.). > > Say you have a contract for a particular exception to occur or not occur. Now > how has your behaviour changed with that knowledge? In my experience, in the > usual case, it's nothing in real terms. All that is usually desired is to > perculate it upward. This is what I meant by referring to static contracts. A subprogram has an exception in its contract when there is *any* possibility for this exception to propagate [in a legal program]. It cannot both "may occur" and "may not occur." > In practical terms, an exception contract primarily affects the programmer in > forcing them to ensure that callers' contracts are compatible. This is > artificial work. Why? Isn't passing a proper floating-type argument instead of anything-with-a-dot-in-the-middle artificial as well? > An exception's type and details are primarily useful for (eventually) showing > to the user, to aid in post-analysis of the problem. OK, this is a fundamental disagreement on what is fault and what is error. We'd better not go into it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de