Re: On the case for exception-based error handling.
[email protected] (Tony Olekshy) Tue, 22 Aug 2000 16:47:54 -0600
| Newsgroups | perl.perl6.language.errors |
|---|---|
| Organization | Avra Software Lab Inc. |
| Message-ID | <[email protected]> |
Oops, accidentally sent message. Here's the final version.
Chaim Frenkel wrote:
>
> Actually, why not simply unwind the call stack to the routine that
> has the pragma active.
>
> sub foo {use exception; &baz()}
>
> sub baz { throw "a fit" }
>
> sub bar {
> no exception;
> &foo();
> }
I don't think that will work. Some routines on the way may expect
to get a chance at $err_code to do their cleanups, and now they're
toast.
> The unwind logic would treat a scope with no exception set _as if_
> each call were wrapped in at try block.
I don't think so. If no exception is in scope Perl should continue
to generate and propagate exceptions (die and $@) as it does now,
so we don't break tradition.
> Fatal checking, is for core functions. And optional for module
> authors.
Yes.
> Then Fatal.pm and exception.pm could possibly be consolidated.
Yes.
Especially if we do that auto-fatal under try thing some others
have written about. I have think about that some more before I
can try to say something intelligent, though. That would imply
dynamic scope for use fatal, and I think it should probably have
lexical scope.
Yours, &c, Tony Olekshy