3 ms·
What? Do you think it's the libraries job to decide that the program should crash or yours? I assume you agree that they should at least declare that they thro
by kjeetgill 8y ago
What? Do you think it's the libraries job to decide that the program should crash or yours?
I assume you agree that they should at least declare that they throw them? I agree that the rethrow should be painless at least.
- groestl 8y agoI'm not sure I follow the first paragraph, but what I'm trying to say is that the JVM can, at any point, present an unchecked exception, or an error. In that case, at the very least, all resources have to be released, and nothing should possibly be left in an invalid state. All this while the stack is unwinding. It's unnecessary to communicate that some call might fail. It's even misleading: a novice might handle a checked exception and rollback some state, but not think of all the implicit exceptions that might occur, e.g. a stack overflow. I'm not even talking about subsystems being replaced by distributed versions (so now there are networking errors too) or similar issues arising from composability. So resource allocation and state logic should be written in a way that assumes everything can crash and burn at any time. And then one can sprinkle recovery and retry logic on top of it, but only in very specific cases, and on specific layers of the application.