RFC 88: Description enhanced.

[email protected] (Tony Olekshy) Tue, 22 Aug 2000 19:13:18 -0600
Newsgroups perl.perl6.language.errors
Organization Avra Software Lab Inc.
Message-ID <[email protected]>
I have modified RFC 88 so that the following

    =head1 DESCRIPTION

     throw Exception::IO "a message", tag => "ABC.1234", ... ;

now reads like this:

=head1 DESCRIPTION

The most common forms of structured exception handling are straight-
forward.  Here they are:

    try { ... } catch { ... }

	Invoke the catch block only if the try block raises an
	exception (aka dies), otherwise, there is nothing to catch.

	Continue unwinding (propagate $@) only if the catch block
	was invoked and it raises an exception too.

	Otherwise, execute the next statement according to local
	flow-control, because either no exception has been raised by
	either block, or one was raised in try but it was cleanly
	caught.

    try { ... } finally { ... }

	Invoke the finally block whether or not the try block raises
	an exception.

	Continue unwinding (propagate $@) if either the try block or
	the finally block raised an exception.

	Otherwise, execute the next statement according to local
	flow control, because no exception has been raised.

    try { ... }
    catch MatchThis => { ... }
    catch MatchThat => { ... }
    catch              { ... } # everything else
    finally { ... }

	In this case if the try raises an exception then the first
	matching catch is invoked, and then whether or not the try
	(or any catch) raised any exception, the finally is invoked.

	Once a catch clause matches, subsequent catch clauses are
	skipped (like elsif/elsif/else).

	This try statement continues excecution normally unless (1)
	try threw and (a) no catch matched or (b) a catch matched
	and its block threw, or (2) finally threw.  Otherwise no-one
	threw, or it was in a try and it was cleanly caught.

	This means that all exceptions propagate unless they are
	cleanly caught, just as in Perl 5.  To prevent this, use:

	    try { fragile(); } catch { } # Go on no matter what.

    try { ... }
    finally { ... }
    finally { ... }

	Do all finallys even if the try block or any finally block
	raises an exception.  Unwind if any block raised an exception.
	See below.

    try { ... }
    catch { ... }
    finally { ... }
    catch { ... }

	Do the last catch if any of the first three blocks raises an
	exception, unless it was cleanly caught (that is, it was in
	try and the first catch didn't raise an exception).  Unwind
	if any block raised an exception, unless it was the cleanly
	caught one.  See below.

More complicated constructs should be avoided unless the rules in
L<Unwinding Semantics> make sense to you and your target audience.

=head2 Walkthrough

 throw Exception::IO "a message", tag => "ABC.1234", ... ;

Yours, &c, Tony Olekshy