For whatever reason it seems a fairly pervasive opinion that an additional 3 lines of error handling boilerplate per function call is more readable somehow: https://old.reddit.com/r/golang/comments/c9qj8j/one_of_rusts_designers_on_going_from_explicit/et3bzu7/ …
-
-
Ivo Georgiev Retweeted ✕✕✕✕✕
Ivo Georgiev added,
1 reply 1 retweet 2 likes -
try makes code less readable because it’s (a) nestable and (b) triggers a function exit. other proposals that also reduce SLoC but don’t have these properties (i.e. are keywords) are much better
3 replies 1 retweet 9 likes -
No, that has not been our experience at all. Try is more than clear and readable enough. I confess I have trouble understanding why the experience of Rust is so casually dismissed in these conversations.
3 replies 0 retweets 11 likes -
Replying to @pcwalton @peterbourgon and
It's like... we literally did an experiment to answer the question "does try reduce readability"? The results were clear.
1 reply 0 retweets 13 likes -
Replying to @pcwalton @peterbourgon and
Mine is a loaded opinion (I agree with Peter), but I think drawing comparisons between Go and Rust's readability may not be effective. People who've used Go substantially are likely to think its readability is one of its best features, and it will be defended as such.
3 replies 0 retweets 4 likes -
I agree, but we're yet to see a constructive and concrete example of when try reduces Go's readbility characteristics
1 reply 0 retweets 0 likes -
literally any example where try is used more than once per line. or when try and if err are mixed in the same function. if you don’t think that’s less readable then
but it’s pretty clearly so to a lot of us.
go isn’t rust, what works in one doesn’t necessarily translate1 reply 0 retweets 2 likes -
Replying to @peterbourgon @Ivshti and
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?
1 reply 0 retweets 0 likes -
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.
1 reply 0 retweets 1 like
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.
-
-
Replying to @pcwalton @peterbourgon and
Like I said, I’ve seen all this before.
1 reply 0 retweets 1 like -
I do t know how else to tell you that you can’t just take a conclusion from one context/dataset and insist it applies equally to another
1 reply 0 retweets 1 like - 7 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.