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,1a4156f047b063f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!87.79.20.105.MISMATCH!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Forcing Exception Handling 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: <02901b13-da72-48ae-9cb3-bf1a10144c44@u3g2000vbe.googlegroups.com> <4d6c07c1$0$6885$9b4e6d93@newsspool2.arcor-online.net> Date: Tue, 1 Mar 2011 09:56:48 +0100 Message-ID: <195bsgigtzacu$.13u18z09ptrtw$.dlg@40tude.net> NNTP-Posting-Date: 01 Mar 2011 09:56:48 CET NNTP-Posting-Host: 4df54f03.newsspool3.arcor-online.net X-Trace: DXC=EcY_6aK4YL3NTD55K=McF=Q^Z^V384Fo<]lROoR18kF7enW;^6ZC`4\`mfM[68DC3YooD]3hS_>6 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:18639 Date: 2011-03-01T09:56:48+01:00 List-Id: On Mon, 28 Feb 2011 16:19:22 -0800 (PST), Shark8 wrote: > In fact, given that Ada doesn't have an "exception hierarchy" like > Delphi does it may be a horrendous idea: There is no way to catch all > exceptions because there is no way to catch a all exceptions of a > certain type (i.e. Storage_Error'Class) which is caused by the lack of > some root-type "Exception_Root." It is a question. Since exceptions are used in case-like clauses, more natural where a model of a discrete type. In order to have constructs like: when Numeric_Exception'First..Numeric_Exception'Last => BTW, it shows the importance of extensible enumeration types, because exceptions should be that kind of type. When exceptions are bunch of types like in C++ you would loose the above. Also consider this: declare Foo : exception: begin ... raise Foo; end; -- Foo propagates out its scope!! Unless Ada would have upward closures, that cannot work when Foo is a type. I hope everybody agrees that upward closures should not be introduced. A possibility to handle this is exception promotion, e.g. Foo to Program_Error, when Foo gets finalized. BTW, contracted exception would solve this problem by making such programs illegal: each block would have an implicit contract not to propagate local exceptions. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de