3 ms·
I think the way Go does error handling is the best compromise.
by SomeRndName11 3y ago
I think the way Go does error handling is the best compromise.
- the_gipsy 3y agoIt's a successful compromise, but probably not the best. It has a huge amount of little issues that simply aren't there with FP error handling.
- kaba0 3y agoGo’s solution is like people couldn’t decide on if they should turn left, or turn right to avoid the cliff, so to make everyone happy they drove straight into it. It is literally the compiler enforced shitty error handling from C’s errno that is not even a sum type.
- vips7L 3y agoIt’s honestly the worst compromise. You can trivially ignore any error in Go and they don’t contain contextual information about the call stack.
- SomeRndName11 3y agoABility to ignore errors is a plus in fact. You can skip trivial non-critical problems and carry on without crashing the whole app, like it is normally done in C and C++.
- vips7L 3y agoIt would be if you would have to explicitly opt into it via an ignored variable like _ or something. But currently with go you can accidentally ignore the error when you don't mean to.
- deleted 3y ago[deleted]
- ziml77 3y agoIt's one of the worst I've seen. It adds so much cognitive overhead to reading the code and makes it more annoying to write. Every function call that can fail is followed by 3 lines to check for and return the error. The actual logic quickly gets lost in there. If it wasn't for the error handling, I would probably use Go for some of my projects. It compiles to a native, self-contained binary and still has the convenience of a garbage collector, and of course has plenty of libs available due to popularity.
- SomeRndName11 3y agoIt does not have all that undpredictability of exceptions, and does not have nasty error handling logic of C. Do you know better alternative?