News for hackers. Stuff that matters.
Re:Google broke a conditional statement that verifies passwo... by gpderetta on Friday July 23, 2021 @05:19AM (#27928758)
But why not? These days reformatting on the fly is fast and easy. Especially if you enforce formatting conventions on commit (so you can automatically reformat into a canonical version).
Re:Google broke a conditional statement that verifies passwo... by d110af5ccf on Friday July 23, 2021 @05:41AM (#27928901)
Because typically code will be read far more than it is written and by far more people than contributed to it. In many cases I won't have the relevant tooling installed let alone know how to use it because I don't use that language myself. (For example, a library written in Rust that exposes C bindings whose prebuilt artifact I might download and link against.)

That being said, I 100% wholeheartedly approve of enforcing code formatting (among other things) on commit. Pre-commit hooks and linters are both awesome.

Re:Google broke a conditional statement that verifies passwo... by gpderetta on Friday July 23, 2021 @06:01AM (#27928991)
If you do not have the relevant tooling you can still read the canonical formatting.

If you want custom formatting, I don't think that expecting your editor to reformat on the fly is a big ask. At the end of the day that exactly what tab proponents expect.

Re:Google broke a conditional statement that verifies passwo... by d110af5ccf on Friday July 23, 2021 @06:20AM (#27929081)
> If you do not have the relevant tooling you can still read the canonical formatting.

Which is often unnecessarily difficult for whatever reason, hence my initial comment. Given that tabs already exist there's literally no reason not to use them other than to intentionally spite any future readers who don't agree with your preference for indentation width.

> that exactly what tab proponents expect

Because that capability is built into even the most primitive of text editors since forever. Per-language formatting, on the other hand, is most certainly not.

Re:Google broke a conditional statement that verifies passwo... by gpderetta on Friday July 23, 2021 @09:28AM (#27930408)
Using just tabs you end up with misaligned code. So you need a mix of tabs and spaces (i.e. smart tabs). But nobody sane [1] would do that by hand and would rely on their editor to do the indenting automatically. At this point just ask the editor to indent on demand.

[1] I'm hyperbolic, sorry if you actually do that although I pity you.

Re:Google broke a conditional statement that verifies passwo... by xupybd on Friday July 23, 2021 @05:56AM (#27928968)
Automated reformats cause big problems in version control.

Every line appears to come from the reformat commit. So it's hard to see when the codes function was changed.

Re:Google broke a conditional statement that verifies passwo... by d110af5ccf on Friday July 23, 2021 @06:25AM (#27929113)
I believe what's being described is on the fly (ie uncommited) reformatting to suit individual reading preferences. Additional enforced autoformatting at the time of commit ensures that all version controlled code always conforms to the chosen style. Thus there are never any reformat commits unless the chosen style is modified.
Re:Google broke a conditional statement that verifies passwo... by gpderetta on Friday July 23, 2021 @06:02AM (#27929001)
you format as part of the commit, not as a separate commit.