At 10:33 PM 8/10/00 +0100, Graham Barr wrote:
>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;

So the user always has to put a die in an else block in the switch if they 
want uncaught exceptions rethrown?  Ugh.  The catch LIST { block } is more 
intuitive.  Surely choosing exception classes for catch blocks does not get 
so complex that we want to use the firepower of the switch statement at the 
cost of usability?

We can dispense with the 'with' keyword, of course.

So I'm thinking:

eval { ...
} catch Exception::Foo {
   ...
} catch Exception::Bar, Exception::Baz {
   ...
} catch {
   ... # everything else, but if this block is absent, uncaught exceptions
       # head up the call stack
} continue {
   ... # Executed after everything
}

If we're really talking about new keywords, we wouldn't need a ; at the end 
of the last block; it's only needed at the moment because eval is a 
function, not a keyword.  I would vote for the keywords only because people 
are going to forget the ; otherwise.

I like reusing 'continue' since I use 'finally' blocks about as often as I 
use 'continue' blocks anyway :-)

--
Peter Scott
Pacific Systems Design Technologies

Reply via email to