I've moved this from perl6-language to perl6-language-flow.
Tony Olekshy wrote:
>
> With the approach proposed in RFC 88 (Structured Exception
> Handling Mechanism), you could write that as:
>
> try {
> } catch {
> switch ($_[0]->name) {
> case IO { ... }
> case Socket { ... }
> }
> }
Graham Barr wrote:
>
> the error are objects, so you need to allow for inheritance.
I was just trying to point out that RFC 88 uses try {} catch {}
instead of try {} otherwise {}, and that the current error comes
into the catch block via @_ (as in RFC 63), so one doesn't need a
"global".
Sometimes you want to collect all the catching into one clause (if,
say, there was lots of common code and little varying code). In
other cases, you want a seperate clause for each exception (if, say,
there is little common code, then the seperate clauses handle the
switch for you, which is more DWIM). That's why RFC 88 allows you
any combination of these operations, as in:
try {
}
except isa => "Foo" => catch { ... }
except isa => "Bar" => catch { ... }
except else => catch { ... }
Again, the differences between this and RFC 63's approach are, in
this case, only syntactic.
Yours, &c, Tony Olekshy