Program logic bugs vs input/environmental errors

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 27 16:15:40 PDT 2014


This issue comes up over and over, in various guises. I feel like Yosemite Sam here:

     https://www.youtube.com/watch?v=hBhlQgvHmQ0

In that vein, Exceptions are for either being able to recover from 
input/environmental errors, or report them to the user of the application.

When I say "They are NOT for debugging programs", I mean they are NOT for 
debugging programs.

assert()s and contracts are for debugging programs.

After all, what would you think of a compiler that spewed out messages like this:

    > dmd test.d
    test.d(15) Error: missing } thrown from dmd/src/parse.c(283)

?

See:

     https://issues.dlang.org/show_bug.cgi?id=13543

As for the programmer wanting to know where the message "missing }" came from,

     grep -r dmd/src/*.c "missing }"

works nicely. I do that sort of thing all the time. It really isn't a problem.


More information about the Digitalmars-d mailing list