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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d303864ae4c70ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-12 03:29:57 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-037-237.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: exception parameters Date: Mon, 12 Apr 2004 12:29:24 +0200 Organization: At home Message-ID: References: <5ad0dd8a.0404090512.15af2908@posting.google.com> <5ad0dd8a.0404091828.6e79bb4e@posting.google.com> <5ad0dd8a.0404100735.7b2a8317@posting.google.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-037-237.arcor-ip.net (145.254.37.237) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1081765795 545356 I 145.254.37.237 ([77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:6994 Date: 2004-04-12T12:29:24+02:00 List-Id: Stephen Leake wrote: > Georg Bauhaus writes: > >> Wojtek Narczynski wrote: >> : raise Bang( Hard, Urgent, -1); >> >> Absent tasks, if I jump long with parameters, doesn't this parameter >> passing mechanism for "exceptional gotos" create a situation where >> program flow is just as hard to follow, or even more so because >> the tasking protocol won't be taken into account? > > Yes, it could be abused. > > But there are places where it would be useful. > > For example, I'm working on a database GUI. The low-level database > interface raises Database_Error with a string parameter. I have to > parse the string to get the actual database error code. It would be > simpler, and actually clearer, if the error code were avaialble as a > parameter. A database connection type may have a primitive operation Get_Last_Error. So when you catch Database_Error and the connection object is still here (why should it disappear?), you can get a detailed error description from it. Get_Last_Error could be made task unique, if connection object will be used concurrently. > I understand there are lots of difficult implementation issues with > general exception parameters, and it can certainly be carried too far. > > Ada allows one string parameter for exceptions. If it also allowed one > integer parameter, that might be a nice compromise :). But the exception is already a sort of number. Why not to allow ranges? Connection_Lost_Error, SQL_Syntax_Error, Unknown_DB_Error : exception; -- A consequent set of exceptions Database_Error renames range Connection_Lost_Error..Unknown_DB_Error; or subtype Database_Error is range Connection_Lost_Error..Unknown_DB_Error; -- A range of exceptions -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de