Changes between Version 1 and Version 2 of ExceptionRefactor

02/23/10 12:31:15 (12 years ago)



  • ExceptionRefactor

    v1 v2  
    2020An exception class will likely extend a more basic exception class in the language. It is easily conceivable that exceptions may be implemented as roles, or using multiple inheritance. 
     22So catching a classed exception either looks like "catch all exceptions, then filter by class, then rethrow the ones you don't like", or it looks like "register the classes you catch, some of which may be subclasses of each other, and have the dispatcher run through the 'isa' query to find a match". 
     24= 'Resumable' exceptions = 
     26Perl is driving the idea of resumable exceptions, I think. (I remember advocating for it on p6l about 80 years ago.) This causes a problem in that a resumable exception doesn't ''necessarily'' roll up the stack. A non-resumable exception, which is what the industry is used to, does. 
     28So a resumable exception is kind of like the old `ON ERR GOSUB` directive - it calls a "sub-routine" (maybe) that might possibly return back to the site of the exception (or to some other continuation, blah blah). Or it might never be heard from again. 
     30= 'finally' = 
     32There's no obvious way to implement `finally`, or something like it, if an outer exception handler is going to ''maybe'' resume the exception. If the exception is non-resumable, you can close those files. If the exception is definitely going to be resumed you should ''not'' close the files. But if you don't know, then what? 
     34(The only answer to this that springs immediately to mind is to have a "last" exception handler that converts a resumable to a non-resumable, and throws ''that.'' I sure hope somebody smarter than me has thought about this...) 
    2236= Requirements =