3 ms·
>The best parts of rust's error handling are the try!() macro (aka `?`), Go's way of providing try!() macro is less magical but almost as useful.[1] > From/In
by aksx 7y ago
>The best parts of rust's error handling are the try!() macro (aka `?`),
Go's way of providing try!() macro is less magical but almost as useful.[1]
> From/Into error types allow the compiler to wrap types or convert between error types
error is an interface in Go which can be easily cast/checked for the underlying type.
> Go's error handling is pretty primitive
I wouldn't call it primitive, I would call it simple. I like the comparison i read on a blog on HN.
Rust is the 'new' C++ and Go is the new C
[1] https://blog.golang.org/errors-are-values https://blog.golang.org/errors-are-values
- xfer 7y ago> error is an interface in Go which can be easily cast/checked for the underlying type. Yeah it's done during runtime and the compiler won't be able to help you with it if you fail to do exhaustive type checking. It's a problem anytime you refactor your code. ADTs and pattern matching is pretty much the bare minimum language feature i expect from any statically typed language.