Re: On the case for exception-based error handling.
[email protected] (Chaim Frenkel) 22 Aug 2000 18:14:29 -0400
| Newsgroups | perl.perl6.language.errors |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "PS" == Peter Scott <[email protected]> writes: PS> From the reactions on this thread so far I am wondering whether the PS> message I sent out about it when it had a different name got PS> through. Relevant excerpt: PS> Well, you could certainly have a pragma that makes throw set $! to the PS> message and does a return undef. But that will only return from the PS> current subroutine; there could be a bunch of module subroutines between PS> that one and the module user. Asking module programmers to keep straight PS> two possible flows of control in error situations, no less, is asking for PS> trouble. If you think it can be made easier, can you show an example? 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(); } The unwind logic would treat a scope with no exception set _as if_ each call were wrapped in at try block. PS> ***But it's entirely up to each programmer whether or not they use PS> Fatal-checking*** This is the Perl way anyway. Fatal checking, is for core functions. And optional for module authors. Then Fatal.pm and exception.pm could possibly be consolidated. <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. [email protected] +1-718-236-0183