3 ms·
Go’s error handling is definitely not better than exceptions, not even close. It is just “errno” from C with bad syntax sugar. Exceptions don’t disappear rando
by kaba0 3y ago
Go’s error handling is definitely not better than exceptions, not even close. It is just “errno” from C with bad syntax sugar.
Exceptions don’t disappear randomly (no, an ‘if err’ is not error handling, and repetition just makes it prone to bugs) and they contain a stacktrace. You don’t have to grep for error messages like some caveman. It even lets you live in some Schrödinger error state where both a value and an error was returned.
- eru 3y agoI have sympathy for your position, but you don't even need exceptions. Go uses a tuple for error handling. As you say the compiler can't help you avoid Schrödinger's errors. If Go instead had used something like Rust's `Result` and had given you the tools necessary for dealing with generics, then most of your objections would go away.