3 ms·
> rust sprinkle ”?” everywhere and wants to avoid dealing with the error You certainly must handle the error if you want your computation to continue. > golan
by pyrale 1y ago
> rust sprinkle ”?” everywhere and wants to avoid dealing with the error
You certainly must handle the error if you want your computation to continue.
> golang is more explicit
Not sure how golang is more explicit. In functor-based style, an error-prone computation stops if it yields an error and that error isn't handled explicitly. That makes sure that any successful computation is based on expected behaviour from beginning to end.
> and robust
Likewise, that's a claim based on nothing. Forcing developers to write a little snippet of code everywhere lest their code has a bug does not make code more robust.
> but I have definitely seen more ”extreme” and correct error handling in golang, whereas in rust the convenience of just bubbling it up wins.
You also have the option to match a result for lower-level error handling in rust.
Claiming that "convenience" makes rustaceans not use that option is like claiming that gophers don't check the error content because it's faster to panic.
- ansc 1y agoMy bad, I should have written in my experience working on larger codebases. It was a bit too general. It was never about the semantics about the language, but about allowing developers to make the correct choice. Kind of why Golang was built for Google I guess. In practice I've found Golang developers to handle errors where appropriate, where in (binary) Rust applications I've usually found `anyhow` everywhere with `?` to be a bit of a silent issue. You're right that the languages have the same capability. The terseness can IMO both be a strength and a liability.