Hmm, it now appears that everything on this subject has to go to 
perl6-language-errors and perl6-language-flow.

At 03:26 PM 8/15/00 -0400, Chaim Frenkel wrote:
> >>>>> "PRL" == Perl6 RFC Librarian <[EMAIL PROTECTED]> writes:
>
>PRL> RFC 80 proposes standard exception classes and methods for core 
>exceptions.
>PRL> This RFC doesn't need to repeat those, but it can expound upon the
>PRL> semantics that exception classes ought to have.  Assume wlog that they
>PRL> all inherit from a base class, C<Exception>.  Some people think that
>PRL> exceptions should not be rethrown implicitly.  We can provide a 
>boolean flag
>PRL> in the class or even the exception object itself to be checked for this:
>
>PRL>      sub Exception::IO::implicit_rethrow { 0 }        # One class
>PRL>      sub Exception::implicit_rethrow     { 0 }        # All classes
>PRL>      throw Exception::Socket(implicit_rethrow => 0);  # Just this 
>exception
>
>
>PRL> [Note: it had been proposed that this functionality would be provided 
>by a
>PRL> method C<uncaught_handler> which would be called if an exception wasn't
>PRL> caught.
>PRL> But if that routine decided to rethrow the exception, the C<continue> 
>block
>PRL> would not get called at the right time.]
>
>Please include the comments about global variables and action at a distance.

I'm sorry, my brain is fried.  Can you spell out for me what you mean in 
this context and I'll put it in.

>PRL> =head2 Exception classes - ignoring
>
>PRL> Note that we could also make it possible to selectively or globally 
>ignore
>PRL> exceptions, so that perl continues executing the line after the C<throw>
>PRL> statement.  Just import a C<ignore> function that takes a class name:
>
>PRL>      ignore Exception::IO;     # Ignore all I/O exceptions
>PRL>      ignore Exception;         # Ignore all exceptions
>
>PRL> and when perl sees the C<throw>, it just does nothing.  (Or do it by
>PRL> overriding a base class method as for C<implicit_rethrow> if you 
>don't want
>PRL> to put another function in the namespace.)  Since C<throw> and C<die>
>PRL> should be essentially identical, this would allow any kind of 
>exception to
>PRL> be ignored, not just the ones that were C<throw>n.  This is not 
>necessarily
>PRL> a good thing, of course.
>
>
>Oh, no! Are you really suggesting that after
>
>         open (FOO, "nonesuch") or throw "file not found"
>
>The next statement continues??????
>
>How in $DIETY's name do you expect to protect code?

I said it wasn't necessarily a good thing :-)  It's in the grand Perl 
tradition of giving you enough rope to hang yourself.  If someone really 
chooses to ignore exceptions, they deserve what they get.  Or maybe, 
they're some kind of wizard who has a good reason in some arcane 
situation.  If you like we could stuff it in a Devel:: module.  But at 
least one person had asked for this IIRC.

>PRL> =head2 $SIG{__DIE__}
>
>PRL> <$SIG{__DIE__}> needs to be triggered only as a I<last> resort
>PRL> instead of firing immediately, since it messes with the mind of this and
>PRL> every other decent exception handling mechanism.  Perhaps it should 
>be axed
>PRL> altogether.  Please.
>
>$SIG{DIE} should die. Action at a distance.  Global. Can't know what
>other threads or modules want done here.

Actually the main problem I have with $SIG{__DIE__} is not that it exists, 
but that it is the *first* handler to fire, rather than the last.  I 
wouldn't have mentioned it otherwise.

There again, if 'try' does an implicit "local $SIG{__DIE__}" at the 
beginning of its block, does that not handle the problem without getting 
rid of the thing?
--
Peter Scott
Pacific Systems Design Technologies

Reply via email to