Kai Henningsen wrote:
> 
> Tony Olekshy wrote:
> 
> > What if we implemented something like the following?
> 
> Seems that the basic unwinder is
> 
> >     except { ... } => catch { ... }
> 
> and everything else can be written in terms of this:
> 
> >     catch { ... }
> 
> except { 1 } => catch { ... }

Yes.  But a simple try { } catch { } is a common use.

> >     catch "ClassName" { ... }
> 
> except { $@->isa($ClassName") } catch { }

Yes.  This one's clearly syntactic sugar, but it may very well be
quite a common usage if Perl 6 goes to internal error exceptions.

> >     finally { ... }
> 
> except { 1 } => catch { ... ; throw $@ }

No.  The finally clause must be invoked whether or not anything
has thrown since the beginning of the try.  Except { 1 } will
*not* match if nothing has been thrown.  Catch and finally are
semantically very distinct.

Yours, &c, Tony Olekshy

Reply via email to