News for hackers. Stuff that matters.
Re:Go and Versioning: Minimal Version Selection by dilap on Thursday February 22, 2018 @12:43AM (#16435381)
Python code is not even close to consistently formatted! You see people using 2 space indents, 4 space indents, tabs...

Though, Python does do a better job than many languages of providing style guidance (pep 8 iirc), and I don't really see people do wacky stuff like messing with where to put space around parens. &c.

Can't speak to Fortran.

Thinking about it, maybe languages like J or APL are always consistently formatted by being so dense there's no room for extraneous formatting?

But certainly for C-like languages I've used, just getting people on the same team to all use the same format was a struggle, much less the whole company, much much less the whole world.

So in that way, gofmt definitely feels revolutionary to me.

Re:Go and Versioning: Minimal Version Selection by pcwalton on Thursday February 22, 2018 @12:52AM (#16435425)
> But certainly for C-like languages I've used, just getting people on the same team to all use the same format was a struggle, much less the whole company, much much less the whole world.

clang-format has really changed the game here. It's commonplace in large projects to run it on every commit.

There is a difference between C and C++ formatting and Go formatting, and it's that Go had gofmt from the start and has always had large social pressure to conform to it. Contrary to popular sentiment, I'm not sure that this is an unmitigated good, though. The reason is that clang-format was designed to mimic the existing style that emerges when programmers manually format code for maximum readability. This forced clang-format to consider comment formatting, line length, argument bin packing, etc. It had to be good, or else it wouldn't get use. On the other hand, because gofmt was guaranteed to get lots of use no matter what, there was less pressure for the result to be readable. This shows up in decisions like the lack of a line length limit.

Re:Go and Versioning: Minimal Version Selection by dilap on Thursday February 22, 2018 @01:04AM (#16435466)
(That's cool to hear about clang-format; I've been out the C++ game for a while, except for the occasional nostalgic prog comp.)

Well, again, I personally don't think line limit should be part of the code style -- it's really handy to be able to split or not split emacs buffers and have the code spill out to take up the space, wrapping dynamically. If the code hard-wraps, you're just stuck w/ that single decision. It's annoying.

Regarding Go's style more generally: Yeah, my own personal pref would be much denser that gofmt, but I happily submit for the consistency.

I just don't think style really matters that much (within the realm of reasonable, which gofmt certainly is): the important thing is consistency.

(By the way, a nice side-effect of consistency: you can easily grep for a particular thing w/ confidence w/o having to try to take into account all the possible stylistic variations.)

Re:Go and Versioning: Minimal Version Selection by pjmlp on Thursday February 22, 2018 @01:47AM (#16435706)
> But certainly for C-like languages I've used, just getting people on the same team to all use the same format was a struggle, much less the whole company, much much less the whole world.

We were using indent with CVS pre-commit hooks in 1999, hardly revolutionary.

Re:Go and Versioning: Minimal Version Selection by dilap on Thursday February 22, 2018 @03:02AM (#16436016)
i can't imagine being happy w/ 1999-era indent autoformatting my code...

but yeah, team style was definitely a solvable problem. global style, manifestly was not solved!

Re:Go and Versioning: Minimal Version Selection by pjmlp on Thursday February 22, 2018 @03:32AM (#16436127)
External libraries are binary dependencies, I don't care one second which style they use to write them.
Re:Go and Versioning: Minimal Version Selection by dilap on Thursday February 22, 2018 @09:36AM (#16437775)
Obviously it's not, like, a world-shattering problem, but I think there is a real, if small, overhead, to switching between different styles when looking at code.

I also just happen to really like things neat a tidy.

Final minor nice thing about having a fixed style: you can grep with confidence, without having to try to encode stylistic variations in the regex.

Re:Go and Versioning: Minimal Version Selection by gkya on Thursday February 22, 2018 @09:19AM (#16437661)
I don't get what's wrong with multiple styles.