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,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Structured exception information Date: Fri, 19 Jan 2007 10:45:30 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1169221530 16965 192.74.137.71 (19 Jan 2007 15:45:30 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 19 Jan 2007 15:45:30 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:VoS290RYD8nPH57MQpRe7jRekx4= Xref: g2news2.google.com comp.lang.ada:8331 Date: 2007-01-19T10:45:30-05:00 List-Id: Stephen Leake writes: > I don't follow. Strings are perfectly valid Ada constructs. Why does > the code to build the string not feel like Ada to you? Building strings is fine. Requiring clients to parse them is evil -- not type safe. The whole point of exceptions is to separate the detection of potential errors from the handing of them. A well-designed exception mechanism would allow the client to make these decisions: Is this condition really an error? If so, is it a recoverable error, or is it a plain old bug? If recoverable, what should I do? If it's a bug, should I print out useful information? Useful to the user, or useful to the programmer who wants to fix the bug (or both)? (Example: if the gnat front end detects a bug in itself, it prints out the line number it was processing at the time, which is useful to the user who wants to find a workaround.) Granularity of handling -- do I want to handle all I/O errors, or just the "disk full" error? Etc. Constructing a string at the "raise" point is wrong because it presumes that the client wants to print a string and exit, and it presumes the format of that string. If that were OK, then why have exceptions -- why not make the code that detects the error print a string and exit? Suppose we want to print error messages in French. If the "raise" point constructs a message in English, the client can't make that decision. - Bob