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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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 Path: g2news2.google.com!postnews.google.com!y3g2000vbh.googlegroups.com!not-for-mail From: iloAda Newsgroups: comp.lang.ada Subject: Re: Forcing Exception Handling Date: Tue, 1 Mar 2011 01:34:02 -0800 (PST) Organization: http://groups.google.com Message-ID: <91988389-b17a-42cb-8f5b-9b1205604b55@y3g2000vbh.googlegroups.com> References: <02901b13-da72-48ae-9cb3-bf1a10144c44@u3g2000vbe.googlegroups.com> <4d6c07c1$0$6885$9b4e6d93@newsspool2.arcor-online.net> <195bsgigtzacu$.13u18z09ptrtw$.dlg@40tude.net> NNTP-Posting-Host: 137.194.2.20 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1298972043 335 127.0.0.1 (1 Mar 2011 09:34:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 Mar 2011 09:34:03 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y3g2000vbh.googlegroups.com; posting-host=137.194.2.20; posting-account=r1a26AoAAAD4nbikbegb_8j7mwzetiwY User-Agent: G2/1.0 X-HTTP-Via: 1.1 proxy.enst.fr:3128 (squid/2.6.STABLE18) X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18640 Date: 2011-03-01T01:34:02-08:00 List-Id: On Mar 1, 9:56=A0am, "Dmitry A. Kazakov" wrote: > 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 =A0all 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 lik= e: > > =A0 =A0when Numeric_Exception'First..Numeric_Exception'Last =3D> > > 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: > > =A0 =A0declare > =A0 =A0 =A0 Foo : exception: > =A0 =A0begin > =A0 =A0 =A0 ... > =A0 =A0 =A0 raise Foo; > =A0 =A0end; =A0-- Foo propagates out its scope!! > > Unless Ada would have upward closures, that cannot work when Foo is a typ= e. > 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 program= s > illegal: each block would have an implicit contract not to propagate loca= l > exceptions. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de Mmmmmm...That's what I was fearing!! Actually the idea behind my question was that I'm working on a real time system, and as u know, we can't afford to a let a real time system crash because of an unhandled exception. Since I use some other libraries in my system (that weren't written by myself or anybody else I know) that will raise exceptions, I wanted to be forced to handle them. I was imagining that it could be done with some kind of a compiler pragma that will force the current package to handle all exception that may be raised, but as u guys pointed out, the compiler might not be able to know which procedure raises an exceptions (by contrast java requires the addition of the "throws" instruction which tells the compiler what's gonna happen) One solution might be to just put the following code everywhere (even though I don't like this): exception When others =3D> -- Do something that will allow the system to keep on running have u guys done something like that before? thanks