On Fri, Aug 11, 2000 at 09:36:32AM -0700, Peter Scott wrote:
> Redirected to perl6-language-flow.
> 
> At 10:39 AM 8/11/00 -0400, John Porter wrote:
> >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();
> >         }
> 
> 

> The only point of using the continue block as you suggest is if there are 
> multiple catch blocks, otherwise you'd just do

Hm, my understanding is that the continue block would be run it there was
an error or not.

So with no errors you do

  execute try
  execute continue

but if there was an error

  execute try
    - die
  execute continue
  execute catch

Graham.

Reply via email to