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!news1.google.com!news.germany.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Structured exception information Date: Mon, 22 Jan 2007 10:28:30 +0100 Organization: CERN News Message-ID: References: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: cernne03.cern.ch 1169458110 24796 137.138.37.241 (22 Jan 2007 09:28:30 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Mon, 22 Jan 2007 09:28:30 +0000 (UTC) User-Agent: Thunderbird 1.5.0.9 (X11/20061220) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:8395 Date: 2007-01-22T10:28:30+01:00 List-Id: Stephen Leake wrote: >> Looking up the localized error message in the dictionary based on the >> *type-safe* error code that it got from the exception object, >> probably? > > Why would it do that? The original problem was "present this > information to the user". Separation of concerns was already presented by Robert, but that's not the whole story. The raising site might not even know where the dictionary is and making it aware would mean reversing the dependency that usual systems have between (G)UI and lower layers. In the extreme case, the team developing the algorithmic part need not be aware that their component will be used in the environment with a dictionary, so even this reversing of dependencies would not be possible in general. > Again, I'm asking for a _detailed_, _real_ example! A real example is a HTTP component that reports error code with value 404 and the GUI leyer that looks up the dictionary of messages for currently selected language to resolve it to whatever is appropriate for display. The HTTP network component should not be aware about the multilanguage abilities of the browser. Dictionary (in the sense of the map that associates error codes with human readable messages) makes it possible. > What will the exception handler do with the result of the lookup? Display it. The point is that the HTTP component has no idea where the display is, not to mention the current language - these are managed by higher levels of the software. You can argue that return code instead of exception might do the job and that's true - but then we are back to the discussion of return codes vs. exceptions, which is a paradigm issue - which should be independent on the technical abilities of each solution. Exceptions should not be any less capable than return values are, otherwise designers cannot make free paradigm choices. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/