I've seen Go folks say, in effect, "Rust's experience with try doesn't apply to Go because Rust users don't have as strong opinions on readability as we do." Oh, you sweet summer child...
There is absolutely nothing wrong with using try more than once per line, or mixing try and if err. Nobody has ever had trouble understanding Rust code that used the equivalents to those features. And yes, our experiences do translate. Why wouldn’t they?
-
-
Go programmers expect and value that escape analysis is trivial: scan for the return keyword. Other conventions of the language reinforce that: early returns and happy path indent alignment. Languages aren’t interchangeable. Expectations and idioms differ.
-
Same in Rust, before we added ?. Rust users “expected and valued” that returns could be visible by just seeing “return” or “try”. We saw people swear up and down that the language would be ruined when we added ?. Now everyone loves the feature.
- 9 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
but it’s pretty clearly so to a lot of us.
go isn’t rust, what works in one doesn’t necessarily translate