|
|
|
|
|
by vbezhenar
297 days ago
|
|
Every function can fail with StackOverflowError and you can't do anything about it. Almost every function can fail with OutOfMemoryError and you can't do anything about it. I've accepted that everything can fail. Just write code and expect it to throw. Write programs and expect them to abort. I don't understand this obsession with error values. I remember when C++ designers claimed, that exceptions provide faster code execution for happy path, so even for systems language they should be preferred. Go error handling is bad. Rust error handling is bad. C error handling is bad, but at least that's understandable. |
|
In user-space, memory overcommit means that we will almost or literally never see an out of memory error.
In kernel space and other constrained environments, we can simply check for allocation, failure and handle it accordingly.
This is a terrible argument for treating all code as potentially failing with any possible error condition.