Walter Bright wrote:
dsimcha wrote:
IMHO the best thing
about exceptions is that they provide a sane default for error
handling: If you
don't handle them then you've effectively asserted that they can't
happen in your
situation. If this "assertion" fails, then our program fails fast and
with an
error message that massively narrows down where the problem is.
It's even better than that. Since the default handling for exceptions is
to print a pretty message, like "cannot open file xxxxx", for many
utility programs that is all you need. You don't have to write any error
handling code, and yet your program handles errors correctly and
gracefully reports them to the user.
I wouldn't go that far. Unfortunately, writing even exception-neutral
code still changes the way one writes code even if you don't need to
handle errors explicitly (fortunately scope statements help with that).
Andrei