Re:The Case for D
by WalterBright on Saturday October 31, 2009 @03:08PM
(#913887)
Uncaught exceptions are caught by the D runtime code, and the appropriate message is printed.
You can declare functions as "nothrow", in which case the compiler will complain about any uncaught exceptions in the function body.
void main() { writeln("about to do something important"); doSomethingImportant(); }
is this really not going to run doSomethingImportant() if the writeln fails? I find that to be a poor default for a systems language.
This may just be a personal preference, but I strongly want a systems language to do one of 2 things:
1) Require me to explicitly state when I care about an operation failing 2) At compile time ensure that my code explicitly states when it's not going to handle an exception. (Java with this, like so many things, gets it 90% right and then falls on its face)
Silently passing exceptions out to the system is a bad default for something that is supposed to be able to be used to build the system!
Note that this preference does not apply for a large swath of applications programming. For a webapp, it may be reasonable to log any uncaught error conditions to a log file, since we can just signal the client to try again.