Re: RFC 80 (v1): Exception objects and classes for builtins

[email protected] (Tony Olekshy) Fri, 11 Aug 2000 10:24:43 -0600
Newsgroups perl.perl6.language.flow
Organization Avra Software Lab Inc.
Message-ID <[email protected]>
I've moved this from perl6-language to perl6-language-flow.

Graham Barr wrote:
>
>     eval {
>             # fragile code
>     }
>         else {                      # catch ALL exceptions
>         switch ($@) {
>             case __->isa('IO')     { ... }
>             case __->isa('Socket') { ... }
>                 else                   { ... }
>         }
>     }
>         continue {
>            # code always executed (ie finally)
>         }

Chaim Frenkel wrote:
>
> Nice.

Hmm.  The eval was commented to indicate fragile code, which is
implied if the keyword try is used.  The else was commented to
indicate a catch, instead of saying catch, and the continue was
commented to indicate a finally, instead of saying finally.

There does seem to me to be some benefit to the clarity of the
RFC 88 approach, which supports both:

	try { }
	except isa => 'IO'     => catch { }
	except isa => 'Socket' => catch { }
	except else            => catch { }
	finally { }

and:

	try { }
	catch {
	    switch ($_[0]) {
		case __->isa('IO')     { ... }
		case __->isa('Socket') { ... }
		else                   { ... }
		}
	    }
	finally { }

Yours, &c, Tony Olekshy