3 ms·
I think consistency is very overrated by the go community. I read and work on a lot of C code, and styles vary considerably. It's just not hard to read code in
by __david__ 9y ago
I think consistency is very overrated by the go community. I read and work on a lot of C code, and styles vary considerably. It's just not hard to read code in different styles. And my main problem is not that `go fmt` enforces a specific style, but that it enforces a specific style that actively harms readability. Defaults are good as long as they are sane, but `go fmt` made some really stupid decisions.
- dilap 9y agoswitching between styles isn't the end of the world, but it's not zero cost either (at least for me). knowing i can confidently grep for something w/o having to try to include style variants is nice. my personal style would be more condensed than gofmt, but it doesn't make any choices i think are really stupid. what bugs you out of curiosity?
- laumars 9y agoThe thing with readability is that consistency matters more than the specific style chosen as any serious time spent with a specific style will teach you to read the code regardless of the chosen style. This is why Perl developers often defend the readability complaints of the language and why C++ style syntax gained popularity despite Pascal's syntax being arguably more readable. My point is everyone will have their own personal preferences about style guidelines and argue that theirs is the most readable but frankly the most readable is just whatever you spend the most time reading. So you quickly get good at reading other language style guides when you spend time coding in their respective languages
- baby 9y agoGo read OpenSSL's code before they decided to have a consistent style[^1] and come back here [^1]: https://github.com/openssl/openssl/blob/7a71af86ce75751f3cb2e9e9e3f2e0715b39b101/ssl/ssl_rsa.c https://github.com/openssl/openssl/blob/7a71af86ce75751f3cb2...