Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

pdd23: closure vs. continuation

11 vues
Accéder directement au premier message non lu

Chip Salzenberg

non lue,
30 juin 2006, 23:11:3930/06/2006
à 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

non lue,
1 juil. 2006, 10:03:4901/07/2006
à 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

non lue,
1 juil. 2006, 14:23:4301/07/2006
à 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 nouveau message