John Porter <[EMAIL PROTECTED]> writes:

> Piers Cawley wrote:
> > 
> > The (continue|always|finally|whatever) clause will *always* be
> > executed, even if one of the catch clauses does a die, so you can use
> > this to roll back the database transaction or whatever else was going
> > on and restore any invariants.
> 
> Which makes me think that it would be nice if the continue block could
> come before the catch block(s):
> 
>       establish_invariants();
>       try {
>               something_risky();
>       }
>       continue {
>               restore_invariants();
>       }
>       catch {
>               handle_error_assuming_invariants_restored();
>       }

Hmm... that doesn't really fit with me too well, kind of the wrong
meaning for continue somehow. Somebody suggested unwind:

    try {
        something_risky()
    }
    unwind {
        restore_invariants()
    }
    catch {
        $@->handle()
    }
    continue {
        do_continuation;
    }

Hmm... it gets convoluted doesn't it?

-- 
Piers

Reply via email to