3 ms·
Okay, I'm totally going to bite on the "find something you don't like in 30 seconds" and it's the hello world example. void main() { writeln("about to do so
by aidenn0 17y ago
Okay, I'm totally going to bite on the "find something you don't like in 30 seconds" and it's the hello world example.
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.
- WalterBright 17y agoUncaught 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.