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!news4.google.com!news2.google.com!news.germany.com!newsfeed.stueberl.de!uucp.gnuu.de!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> <13d6dfmiauvby.1ntqh3qbr07gr$.dlg@40tude.net> Date: Tue, 16 Jan 2007 16:15:33 +0100 Message-ID: <140lcoo9gyxbt$.1uptlsnkjb2j6.dlg@40tude.net> NNTP-Posting-Date: 16 Jan 2007 16:15:33 CET NNTP-Posting-Host: 015baa4f.newsspool1.arcor-online.net X-Trace: DXC=7dGo=cG>7HJ78PK[oJ2ng@ic==]BZ:afN4Fo<]lROoRA^YC2XCjHcbIDoC`<6F[4mDDNcfSJ;bb[EFCTGGVUmh?DN\HXHJ4e80N]`_\bg6NTeF X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8177 Date: 2007-01-16T16:15:33+01:00 List-Id: On Tue, 16 Jan 2007 15:44:43 +0100, Maciej Sobczak wrote: > Dmitry A. Kazakov wrote: > >>>> procedure Foo raises Some_Error'Class; >>>> >>>> should be illegal. >>> Why? >> >> Because otherwise you could raise a type from the class, of which scope is >> narrower than one of the handler. > > Then I would expect slicing to the type that the handler sees. That does not work because slicing could yield an abstract type. This would not be a view change, because exceptions are rather "marshaled," for many reasons. Consider: type Local_Type is ... type Local_Exception is ... with record X : Local_Type; -- This must be finalized upon leaving the scope end record; I.e. you have to create a truly new sliced object. An abstract one cannot be, and it would be a quite overhead. > Which brings another point - the handler has to *see* the type it wants > to handle, which means that the type in question cannot have narrower > scope anyway and even if it has, the handler will not be able to misuse it. Right. This is why contracts is potentially *the* answer. >> when E : Some_Error'Class => >> when E : Some_Error => >> >> We definitely do not want whens to become ordered. > > You have them ordered already, just not in a sequence, but across all > enclosing scopes (handlers are searched from "inside" to "outside", so > they might as well be traversed from top to down in addition). I don't > see much difference. "when" in exception has the meaning of exclusive or, same as in case. Otherwise it would be "elsif." >> Even less, to have >> contracts which cannot be checked. > > You can check it. Java guys did it, so there is a prior art. :-) Did they anything right? (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de