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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7d3cb5920e882220 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!fi.sn.net!newsfeed2.fi.sn.net!news.song.fi!not-for-mail Date: Wed, 12 Dec 2007 13:37:09 +0200 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Exceptions References: <5947aa62-2547-4fbb-bc46-1111b4a0dcc9@x69g2000hsx.googlegroups.com> <475c6ed8$0$13111$9b4e6d93@newsspool2.arcor-online.net> <1kxk3hlfa25dw$.fl2wvbn0tpbg$.dlg@40tude.net> <475d296a$0$27813$4f793bc4@news.tdc.fi> <12mjar2f2t2e6$.o2upq0n29j1f.dlg@40tude.net> <475d99c6$0$3520$4f793bc4@news.tdc.fi> <1x0h6yxp9rhy1.1thonmo9cmwy3$.dlg@40tude.net> <475e8bde$0$27850$4f793bc4@news.tdc.fi> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <475fc4c9$0$27835$4f793bc4@news.tdc.fi> Organization: TDC Song Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1197458633 news.tdc.fi 27835 81.17.205.61:32796 X-Complaints-To: abuse@tdcnet.fi Xref: g2news1.google.com comp.lang.ada:18909 Date: 2007-12-12T13:37:09+02:00 List-Id: Randy Brukardt wrote: > "Niklas Holsti" wrote in message > news:475e8bde$0$27850$4f793bc4@news.tdc.fi... > ... > >>And perhaps also >> >> 5. Exceptions as formal generic parameters. > > > Ada has this (although it isn't obvious): just pass an > Ada.Exceptions.Exception_Id to the generic. That is, given a generic spec > something like: > > generic > My_Exception : Ada.Exceptions.Exception_Id := > Constraint_Error'Identity; > package Gen is ... Ha, a good technique to know, thanks. > In any case, the fact that it is relatively easy to do this is why there is > no formal exception parameter. If the implementation with Exception_Id is so easy, I wonder that the syntax with "exception" as formal parameter is not included in the language. But I know that language extensions are prioritized, and in fact I have never needed a formal exception parameter, although I have sometimes written wrappers for instances of generics just to translate an exception defined and raised by the generic into some other exception for the user of the generic. In any plan to extend Ada with exception contracts, I think that formal exception parameters should be included, or else the contract should allow exceptions to be named by Exception_Id as well as by the lexical identifier. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .