3 ms·
> Exceptions are starting to feel like a legacy programming paradigm to me. Rust & Go have, at least in a practical programming context, shown that errors-as-va
by dmitriid 4y ago
> Exceptions are starting to feel like a legacy programming paradigm to me. Rust & Go have, at least in a practical programming context, shown that errors-as-values has far less footguns
They don't really. Because they force you to handle errors even in code that couldn't care less about errors because that's the responsibility of a higher level up the stack. And worse, they assume that an exception is a valid reason to just stop program execution altogether (when it rarely is).
See Erlang for how you should handle exceptions (you have a supervision tree with various restart strategies).
- dmitriid 4y agoJust remembered that Rust realised that manual handling of errors everywhere doesn't work, and introduced `try!` macro, and then the `?` operator. These are more practical (and good thing Rust isn't rigid at the expense of pragmatism). And of course since panics are not the answer to everything exceptional, there's now a `catch_unwind`, too