Evan Howarth wrote:
>
> Tony Olekshy wrote:
> >
> > Just be sure to arrange to handle exceptions while handling
> > exceptions.
>
> Are you saying that the try-catch proposal automatically
> handles exceptions thrown in catch and finally blocks?
Yes.
> That's an interesting idea. Java, C++, and Delphi don't do
> that for you. They expect the programmer to either avoid
> or correctly handle exceptions in catch and finally blocks.
Right, and in practice, it drives me nuts, because if I have
a try, a conditional catch, and a finally, I want the finally
to happen whether or not the code in the catch throws.
> How does try-catch handle exceptions in catch and finally
> blocks. Does it just eat them?
The basic syntax considered in RFC 88 is:
try { ... throw ... } # try clause
except TEST => catch { ... } # 0 or more
catch { ... } # 0 or more
finally { ... } # 0 or more
unwind { ... }; # 0 or 1
The basic semantics are:
* The try clause is evaluated.
* Each catch clause is invoked, but only if an exception has
been raised since the beginning of the try statement, and
the catch clause's except TEST is true or is not given.
* Each finally clause is invoked whether or not an exception
has been raised since the beginning of the try statement.
* The unwind clause, if any, is invoked if an exception has
been raised since the beginning of the try statement, and
it has not been cleanly caught.
* After processing all clauses, try unwinds (dies) iff any
exception wasn't cleanly caught.
An exception is considered to be "cleanly caught" if it was in
the try clause, and it triggered a catch clause, and no catch
or finally clause raised an exception. There are some other
semantics that come into play with multiple catch clauses, for
detailed information see RFC 88.
Yours, &c, Tony Olekshy