in reply to Re: subroutine prototypes still bad?
in thread subroutine prototypes still bad?

That's actually a good example of why prototypes are *bad*. It looks so much like normal Perl code, one might be tempted to return from the catch block.

sub { try { ... } catch Exception with { return 0; }; return 1; }

However, a return in catch block only exits the catch block! The above function would always return 1.

Replies are listed 'Best First'.
Re^3: subroutine prototypes still bad?
by dmitri (Priest) on Jun 13, 2007 at 14:09 UTC
    I think it depends on what you are used to. I recently had to write some Java code, and I found myself putting 'return' statements outside of try/catch, even though it's fine in Java.

    Since I use mostly Perl, this behavior does not confuse me at all.

      To me, that sounds like you're doing somthing so dangerous that you won't even do it in a language where it's safe in fear of getting it wrong in Perl.
        I was just making a point about being used to things. C programmers are used to allocating memory by hand, for instance. It's just a matter of what the language gives you.