Path: news.daimi.aau.dk!news.uni-c.dk!newsfeed.sunet.se!news01.sunet.se!sunic!news99.sunet.se!columba.udac.uu.se!news.mdh.se!news.seinf.abb.se!erinews.ericsson.se!eua.ericsson.se!cnn.exu.ericsson.se!newshost.convex.com!news.duke.edu!news.mathworks.com!news.kei.com!nntp.coast.net!fu-berlin.de!zrz.TU-Berlin.DE!marie!wpp From: wpp@marie.physik.TU-Berlin.DE (Kai Petzke) Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather Subject: Re: What Should An Exception Handling Do? -- Clarification of rules Date: 1 Apr 96 14:54:37 GMT Organization: Technical University Berlin, Germany Lines: 58 Message-ID: References: <4irn11$7ln@mimas.brunel.ac.uk> <4j03p4$fbt@hoho.quake.net> <4jcf89$2k9@crc-news.doc.ca> <4jdv0p$lnr@dscomsa.desy.de> NNTP-Posting-Host: marie.physik.tu-berlin.de Xref: news.daimi.aau.dk comp.object:53633 comp.lang.eiffel:22636 comp.lang.c++:176381 comp.lang.beta:10701 comp.lang.java:30863 comp.lang.sather:12390 mernst@x4u2.desy.de (Matthias Ernst) writes: >The idea of resumption or retry is that after an inner frame throws an >exception the outer handler may alter the state or supply more information >and then _REENTER_ the inner frame either at the point where the exception >was thrown (resumption) or at the beginning of the try block (retry). I ask myself, why there should be only these two possibilities - resumption at the throw point versus restart of the complete try block. Together with the "abort" method, that leaves a total of 3 alternatives, that an error handler may choose from. Well, that was up-to-date back at the days, that people invented MS-DOS. Most of you probably have seen that pop-up window, that says something like: "read error on drive A:", and then lets you choose from "Retry", "Ignore" (which is a very crude implementation of the "resume" case from above) or "Abort". Intelligent applications may want to provide more alternatives. A typical one is: "Recover from backup media". In video and audia data processing, the following might be usefull: "Replace faulty disk block with interpolation of the data from neighboring blocks". (High-end compact disk players do this automatically, btw.). Or: "Cut out the frames, that cannot be read". In such a more user friendly scheme of error recovery, resumption has to be performed at different levels of the data reading routine, depending on the users choice at run time. In some cases, a complete new file has to be opened and read. In other cases, reading is continued at a later position in the file, requiring to modify some loop indexes in the reading code, as well, as to re-position the file. I don't know, though, if the above is a real-world example. Most people don't seem to program that way. But it is an example, of what *I* like to be able to do. It requires: * The exception handler must have both access to the context of the caller as well to that of the callee. In particular, the callee's data must still exist, when the exception handler is reached. * The exception handler must be able to decide, where to resume the execution of the callee, whether at the throw point, at some designated breakpoint, or not at all. I don't see, how C++'s throw/catch/try scheme is able to handle this general case. This is one of the reasons, why I dislike C++, and prefer BETA. But this is a question of taste, not a question of reason. Kai -- Kai Petzke, Technical University of Berlin, Germany http://www.physik.tu-berlin.de/~wpp/ to learn about Linux, Postgres and BETA. wpp@marie.physik.tu-berlin.de for regular e-mail How fast can computers get? -- Warp 9, of course, on Star Trek.