On Thu, Aug 10, 2000 at 04:34:50PM -0400, Chaim Frenkel wrote:
> Nice.
> 
> The continue clause, I assume would re-raise an uncaught exception.
> But, a big but. How does the 'else' clause indicate that the exception
> was handled?

By not rethrowing it. ie if it does not want to handle the
error itself it just calls    die;

Which will call PROPAGATE on the object in $@, just like perl5, then
look back up the call-stack for the next eval { }

Graham.

> A couple of possiblities
> 
> 1. Undef $@. But that's a bit of extra work in each leg.
> 
> 2. switch is 'slightly' special in an eval/else block. If the case
>    selects the error, then it is considered handled unless a die or
>    redo is encountered.
> 
> 3. If continue is not being used by Damian's switch, then a continue
>    continues onto the continue block, and marks the successful handling
>    of the exception.
> 
> <chaim>
> 
> >>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:
> 
> GB> I was more thinking of
> 
> GB>   eval {
> GB>           # fragile code
> GB>   }
> GB>         else {                    # catch ALL exceptions
> GB>       switch ($@) {
> GB>           case __->isa('IO')     { ... }
> GB>           case __->isa('Socket') { ... }
> GB>                 else                   { ... }
> GB>       }
> GB>   }
> GB>         continue {
> GB>            # code always executed (ie finally)
> GB>         }
> 
> GB> And the only new keywords are for the switch statement.
> 
> -- 
> Chaim Frenkel                                      Nonlinear Knowledge, Inc.
> [EMAIL PROTECTED]                                             +1-718-236-0183
> 

Reply via email to