Re: errors and their keywords and where catch can return to and stuff like that
[email protected] ("James Mastros") Mon, 14 Aug 2000 14:50:01 -0400
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <009001c00620$7443e2a0$0100000a@lilith> |
From: "Peter Scott" <[email protected]> Sent: Sunday, August 13, 2000 10:35 PM > try { > # fragile code which doesn't call any subroutines that might die > # and doesn't include any other try blocks > } catch { > # No code at all > } Well, I don't really like that solution. It's exactly the same situation as use strict / use warnings, BTW. I don't much like that either, but... In any case, there we have exactly the situation we're speaking about (well, in warnings, anyway) -- a heirichy of exceptions. Therefore, I think we want some generic mechinisim to say what the behavor of an uncaught exception is. My proposal is: $Exception::<whatever>::onuncaught = CODEREF. Yes, this is a global. It has to be; the definition of when/how this gets called is that if the unwind stack goes all the way /past/ the root of the code, this code ref gets called. The only parameter is the exception. The defalut would be sub {die shift;} (for "obviously" fatal things), which would make the program exit with a fatal exception. Other normal choices would be undef, ignore it (non-defualt warnings, like bareword), and sub {warn shift;}, print out a warning message (default warnings, like... I can't think of any). The value of onuncaught should follow isa if it doesn't exist. -=- James Mastros