Live data from Hacker News

Reformatting 100k Files at Google in 2011

laurent.le-brun.eu

161–162 of 162 posts

Re: Reformatting 100k Files at Google in 2011

#161
post #160

Earlier quoted context omitted.

Let’s look at a real example. Here’s the source code for binary search from rust’s standard library: https://doc.rust-lang.org/src/core/slice/mod.rs.html#2786-28... The function is pretty short - 40 lines including comments. Despite how short the function is, it still uses whitespace to separate and group adjacent lines of code. Personally, I find the code more readable like this. Indentation makes syntactic blocks o…

All of the blank lines can be deleted from that function without reducing the readability.

Maybe for you. But it would reduce the readability for me.

At a minimum, the blank lines implicitly scope the comments that sit above connected code blocks. Those comments - especially the comment about safety - would be harder to understand and audit without its context being so clear.

And again, can you name any benefit to removing all the blank lines? If we can both read the code easily with some empty lines to space it out, that seems like the best option.

Re: Reformatting 100k Files at Google in 2011

#162
post #72

Earlier quoted context omitted.

This is true but I think it would still be nice for VCS to have a first class concept of "peek through" changes (whitespace, formatting, etc.) for the purpose of blame.

It does. Just put ignored commits in a file: https://docs.github.com/en/repositories/working-with-files/u...

Thanks! Didn't know about this cool feature.
Post reply on HN