3 ms·
I agree that the error handling is terrible, but I'm not sure how much better it could be without generics. For me, the gold standard in error handling is Rust
by autarch 6y ago
I agree that the error handling is terrible, but I'm not sure how much better it could be without generics.
For me, the gold standard in error handling is Rust, where the type system simply does not allow you to ignore errors. This means that the existence of error handling is checked at compile time. Of course, this doesn't mean your error handling is _good_, but I think that's beyond any language design to enforce.
But the Rust system is entirely built around a generic Result type, where both the non-error result (an int, string, struct, etc.) _and_ the error type itself are both generic.
- papaf 6y agothe type system simply does not allow you to ignore errors Which is excellent. the gold standard in error handling is Rust Really? What library is in fashion this week for handling errors? I have so far used vanilla Rust, error-chain and Failure. Seems like there is so much choice to improve the gold standard: https://blog.yoshuawuyts.com/error-handling-survey/#libraries https://blog.yoshuawuyts.com/error-handling-survey/#librarie...
- simias 6y agoGo uses compiler magic to have effectively generic collections, why not hardcode a Result type in the same fashion? It's not very elegant, but it's pragmatic and error handling is important enough that it may well warrant it.
- autarch 6y agoYeah, that's a fair point. I imagine this could be better than what's there now.