4 ms·
To be fair in rust you get to write .into() or Ok a lot. I do find Go's error handling annoying but rust seems similar for line noise. It's more compact noise,
by esprehn 5y ago
To be fair in rust you get to write .into() or Ok a lot.
I do find Go's error handling annoying but rust seems similar for line noise. It's more compact noise, but it's all there.
- avgcorrection 5y ago> To be fair in rust you get to write .into() or Ok a lot. Sure. If “fair” means “not comparable at all”. if-condition-return using two variables is not comparable to one function/macro call.
- maleldil 5y agoThose are for the cases where you're creating or transforming an error. In those scenarios, Go's handling isn't that bad. The issue is having to write `if err != nil { return nil, err }` versus `func()?`. The former gets old really fast. Not to mention the other benefits of monadic error handling when compared to glorified error codes.
- mcronce 5y agoEven transforming an error is taken care of by ? func()? desugars to (more or less) match func() { Ok(v) => v, Err(e) => return Err(e.into()) } I'm also not really sure what the complaint is. Go doesn't do any more implicit type conversion than Rust does. There are numerous solid arguments for Go over Rust, but error handling and automatic type punning aren't on the list.