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
-
-
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 -
Tony “Abolish ICE” Arcieri 🦀 Retweeted Tony “Abolish ICE” Arcieri 🦀
I think you're right, i.e. this is how Gophers feel about the language, but as someone who spends a lot of time reading Go code (and in particular Go cryptography code) I'm always left wanting something better, particularly around error handlinghttps://twitter.com/bascule/status/1148274481372131332 …
Tony “Abolish ICE” Arcieri 🦀 added,
Tony “Abolish ICE” Arcieri 🦀 @basculeReplying to @bascule @reaperhulk @veorqAs it were, just came across this: how Go handles PSS. Love the comment and the solution (although I find the implementation fairly unreadable) https://github.com/golang/go/blob/master/src/crypto/x509/x509.go#L443 … pic.twitter.com/7hiU8WSzcs2 replies 0 retweets 4 likes -
Here are a couple of other examples from the same file (from Go stdlib). Personally I find the error handling logic in these cases convoluted and a bit hard to follow. https://github.com/golang/go/blob/master/src/crypto/x509/x509.go …pic.twitter.com/GKDgnzoRwe
3 replies 0 retweets 2 likes -
Ouch, yeah, mixing err != nil and err == nil like that is rough. Give me try any day.
1 reply 0 retweets 3 likes -
try is not applicable to that example
1 reply 0 retweets 0 likes -
Replying to @peterbourgon @pcwalton and
Here's a quick-and-dirty Rust translation of that code which uses try:pic.twitter.com/AFHAY4iDn5
1 reply 0 retweets 1 like -
Replying to @bascule @peterbourgon and
Feels a bit awkward though, because in Rust I'd have a PublicKey enum with a PublicKey::parse method that returned corresponding variants for PKI(X?) and PKCS1, so as to eliminate one of the error cases in the first place (I do this all the time with public keys)
1 reply 0 retweets 0 likes
That is so much more readable than the Go version…
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.