develooper Front page | perl.perl6.language.flow | Postings from August 2000

Re: RFC 80 (v1): Exception objects and classes for builtins

Thread Previous | Thread Next
From:
Tony Olekshy
Date:
August 11, 2000 11:23
Subject:
Re: RFC 80 (v1): Exception objects and classes for builtins
Message ID:
399428C7.2BC9347B@avrasoft.com
I've moved this from perl6-language to perl6-language-flow.

Chaim Frenkel wrote:
>
> Why add another keyword. Just extend eval{} to accept two blocks.
>
>   eval { } catch { } finally { }

RFC 63 and RFC 88 are based on existing Perl 5 implementations,
so they define a subroutine called "try" to avoid the confusion
that would be caused by defining a subroutine called "eval".

If this stuff gets into the core of Perl 6, then "eval" could be
used instead of "try".  I do however think that "try" is somewhat
clearer, since that's what were doing here.

> With the catch block setting the lexical $@ to the exception.

Again, because of the existing Perl 5 implementations, RFC 63 and
RFC 88 have to internally wrap the catch clause in an eval, so
that if it throws the exception can be trapped, the finally clause
invoked, and the exception re-raised.  Inside the internal eval
$@ is cleared, so RFC 63 and RFC 88 pass the current exception to
the catch block via @_.

Yours, &c, Tony Olekshy

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About