Re: RFC 88: What does catch "Foo" { } do?

[email protected] (Graham Barr) Sun, 20 Aug 2000 08:16:17 +0100
Newsgroups perl.perl6.language.errors
Message-ID <[email protected]>
On Fri, Aug 18, 2000 at 11:04:03PM -0600, Tony Olekshy wrote:
> As currently promulgated, catch "Foo" {} will always catch,
> because "Foo" is true.  Will this cause confusion for developers
> who meant to say catch Foo {}?  And what happens when someone
> says catch "Foo", "Bar" {}?
> 
> We can't just say that catch Foo {} and catch "Foo" {} are the
> same thing, or that catch "Foo" {} is outlawed, because catch
> $test {} is supposed to work even if $test *is* a string.
> 
> Or can we?  I'm not a parser expert.
> 
> And while I'm on the topic, how likely is it that
> 
> 	catch <expr> { ... }

I am of the opinion that only a class name should follow catch.

If someon wants to catch based on an expression they should
use
  catch {
    if (<expr>) {
    }
    else {
      # rethrow the error
    }
  }

Graham.