Darren New wrote:

People who like exceptions like them for the same reason that people who don't like them dislike them: they're non-local control structures, and therefore impossible to ignore.

Pretty much.

However, generally the people who whinge about non-local control wind up creating deep conditionals checking bunches of error codes. And what do they put all over that code:

    // Do the initial thing

    if (foocondition) {
        // Do cleanup
        return FALSE;
    }

    if (barcondition) {
        // Do cleanup
        return FALSE;
    }

    <finally do the real work>

Which are all effectively non-local control gotos.  Just like exceptions.

At this point, I have been using both long enough that I am pretty convinced that exceptions are interchangeable with return codes.

IMO, exceptions should be a language feature that abstracts away the writing of that return code checking code.

I also like the way things like Lisp/Scheme can use exceptions/conditinals to actually allow you to restart and resume the computation after adjusting the environment.

-a

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to