Re: errors and their keywords and where catch can return toandst uff like that

2000-08-15 Thread Graham Barr

On Mon, Aug 14, 2000 at 10:15:21PM -0700, Peter Scott wrote:
 At 08:56 PM 8/14/00 -0600, Tony Olekshy wrote:
 consider this:
 
  try { may_throw_1; }
  catch   { may_throw_2; }
  catch   { may_throw_3; }
  finally { may_throw_4; }
 
 That's either a syntax error or a no-op.  More likely the latter.  If you 
 have multiple catch blocks which could catch the same exception, only the 
 first one should execute.

Yes.

Graham.



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

2000-08-11 Thread Graham Barr

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.