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,b78c363353551702 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.220.230 with SMTP id pz6mr23834963pbc.3.1340226262604; Wed, 20 Jun 2012 14:04:22 -0700 (PDT) Path: l9ni300pbj.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: about the new Ada 2012 pre/post conditions Date: Wed, 20 Jun 2012 23:04:17 +0200 Organization: cbb software GmbH Message-ID: References: <4f0d55a9-83e1-44fe-8943-0c73a34a594d@googlegroups.com> <218d3055-5610-491f-9f9f-5b08dbdbc720@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 4RFYTQ6jM/dAKFJoI0fUkg.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: 2012-06-20T23:04:17+02:00 List-Id: On Wed, 20 Jun 2012 13:51:32 -0700 (PDT), Maciej Sobczak wrote: > Decades of experience (OK, Java is a bit younger) show that it will usually be used as: > > begin > Push (S, Element); > exception > when others => null; > -- TODO: (errr, it never happens, right?) > end; > > The first version is at least easier to follow in the debugger... Not in Ada where exceptions are not contracted. In Ada one just forgets to catch. Which raises an interesting question: if Ada had contracted exceptions, people would start adding meaningless when others =>. But with contracted exceptions the compiler would know all exceptions possible in the context. We could make others an illegal choice in such cases. The programmer would have to explicitly specify exceptions to catch. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de