Hacker News new | ask | show | jobs
by benashford 3669 days ago
Go's approach requires specific code to handle errors in each and every function, and it's very easy to forget or introduce a bug in the propagation of the errors (or to ignore one altogether).

So I wouldn't use that as proof that the world has settled on global "stop the world" exceptions vs checked exceptions.

Rust is another one that requires specific Result<DataType, ErrorType> to be passed back to a calling function, that either contains the return value or an error. But unlike Go, it's very difficult to ignore the error entirely, but it does require code to handle and propagate errors up the stack.

Although both Go and Rust also have the concept of a panic, that does stop the world (or at least the current thread, unless the panic is captured but that's another story...).

1 comments

It's pretty difficult to ignore an error entirely in Go as there's a syntactical red flag everywhere you do it.

The problem with Go's error handling is that it doesn't play nice with using functions as part of larger expressions.