Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pdd23: closure vs. continuation

10 views
Skip to first unread message

Chip Salzenberg

unread,
Jun 30, 2006, 11:11:39 PM6/30/06
to Allison Randal, perl6-i...@perl.org
Just before I committed pdd23 as it currently is, I asked Audrey whether it
was better to make handlers continuations or closures. She said it was not
important, and to choose whichever is faster. However, I think I erred in
choosing continuations.

In the continuation model (as in pdd23 at present), the exception handler
runs _outside_ the dynamic scope where the exception occurred, which means
that dynamically scoped state required to describe, diagnose, or fix the
exception is not available.

"Oops."

Allison, if you give me the OK, I'll recast pdd23 in the alternative way I
had in mind, where:

* exception handlers are closures,

* the closures are called _inside_ the dynamic scope where the throw occurred,

* a closure returning without executing C<caught> implies "I didn't handle
it, try the next handler",
therefore obviating the "rethrow" opcode.

PS: "caught" will perhaps be better renamed "handled".
--
Chip Salzenberg <ch...@pobox.com>

Bob Rogers

unread,
Jul 1, 2006, 10:03:49 AM7/1/06
to Chip Salzenberg, Allison Randal, perl6-i...@perl.org
From: Chip Salzenberg <ch...@pobox.com>
Date: Fri, 30 Jun 2006 22:11:39 -0500

. . .

Allison, if you give me the OK, I'll recast pdd23 in the alternative way I
had in mind, where:

* exception handlers are closures,

* the closures are called _inside_ the dynamic scope where the throw
occurred,

* a closure returning without executing C<caught> implies "I didn't handle
it, try the next handler",
therefore obviating the "rethrow" opcode.

PS: "caught" will perhaps be better renamed "handled".
--
Chip Salzenberg <ch...@pobox.com>

I'm still trying to catch up, but IMHO, this is all to the good.

-- Bob

Allison Randal

unread,
Jul 1, 2006, 2:23:43 PM7/1/06
to Chip Salzenberg, perl6-i...@perl.org
Chip Salzenberg wrote:
>
> Allison, if you give me the OK, I'll recast pdd23 in the alternative way I
> had in mind, where:
>
> * exception handlers are closures,
>
> * the closures are called _inside_ the dynamic scope where the throw occurred,
>
> * a closure returning without executing C<caught> implies "I didn't handle
> it, try the next handler",
> therefore obviating the "rethrow" opcode.

Thumbs up.

> PS: "caught" will perhaps be better renamed "handled".

Agreed.

Allison

0 new messages