On Tue, Oct 15, 2002 at 01:44:50PM -0500, Jonathan Scott Duff wrote:
> People have used the terms "error" and "exception" interchangably in
> this disucssion.  To me, an "error" is something that stops program
> execution while an "exception" may or may not stop execution depending
> on what the user decides to do about exceptions.

Unless I've missed my mark, Perl errors have always been trappable [1].  Does
that make them exceptions?  We've been calling them errors for years now.

Put another way, is there a significant difference between:

    eval {
        $foo = 1/0;
        print "Bar";
    }
    if( $@ =~ /^Illegal division by zero/ ) {
        ... oops ...
    }

and

    try {
        $foo = 1/0;
        print "Bar";
    }
    catch {
        when /^Illegal division by zero/ {
            ... oops ...
        }
    }

(putting aside that exception handlers stack).

Whatever you call it, exception or error, it will halt the program if left
unhandled.


[1] Less the few odd really hard core "the interpreter is having a bad trip"
sort of errors.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
Here's hoping you don't harbor a death wish!

Reply via email to