Re: Exceptions and Objects
[email protected] (Jonathan Scott Duff) Tue, 15 Aug 2000 11:43:41 -0500
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 14, 2000 at 08:50:41PM -0600, Tony Olekshy wrote:
> Jonathan Scott Duff wrote:
> > try { }
> > catch { # ALL exceptions
> > switch ($@) {
> > case ^_->name eq 'IO' { ... }
> > case ^_->canFoo { ... }
> > throw $@; # No cases matched, rethrow
> > }
> > }
> > finally { }
>
> This is why RFC 88 is working on syntax and semantics for:
>
> try { ... } except sub { $_[0]->CanFoo } => catch { ... }
>
> which *does* unwind if $_[0] can't Foo (or, if $_[0]->CanFoo or the
> catch clause throws).
Er, why? What's wrong with just using the switch statement? It seems
like except and catch are becoming special-purpose switches to me. Is
it really necessary?
-Scott
--
Jonathan Scott Duff
[email protected]