Larry Wall |Perl 6| wrote:
    a() orelse b()

you might want to:
    succeed on a()
    trap mild failure of a() and try to succeed on b() instead
    fail completely on drastic failure of a()

At the moment this three-way distinction depends on whether a() returns
defined/undefined or throws an exception.  Maybe that's good enough.
I don't want to overcomplexify things, but I don't want to
undercomplexify them either.  :)
I'm thinking that, rather than have a zillion options to pre-configure the fail mode of that group of functions, it can be done by having a CATCH handler that calls resume on the ones you want to pop back out.

 {  # some block scope
 use fail;
 a() orelse b();
     when xxx { .resume() }

This is also handy in that you can set flags or something before getting back to the main expression. This makes EH more like a "footnote" to the code than anything I've used before.


Reply via email to