What memory allocation errors are to C, runtime exceptions are to very high level languages (JS/Python/Ruby). If the memory allocator or something fundamental fails, it makes sense that the process crashes because all bets are off. But checking a property of undefined making the entire process crash and wipe all the intermediate state that is nowhere persisted? That is nuts.
The issue can be solved by:
- Making exceptions simple values that are stopping. Unless something fundamental in the engine breaks, the process never breaks.
- All state is first class and persisted until cleaned. So there is no collateral damage of an error, which is typical on high level runtimes.
It’s not even “let it crash” (like Erlang). Errors are not crashes.
I would say it’s nuts that this is so, but then again, we’re in 2025 and we’re still seeing a ton of high profile bugs coming from manual memory allocation in software that doesn’t need to allocate its own memory.
This can only be fixed at the programming language/environment level.