3 ms·
Since we’re doing this… ;) I’m actually coming around on really narrow conventions since tiny laptops started getting really good. I used to think 80-wide col
by benreesman 4y ago
Since we’re doing this… ;)
I’m actually coming around on really narrow conventions since tiny laptops started getting really good.
I used to think 80-wide columns and 1-2 space indent was silly retro stuff in an era of modern displays.
But on an M2 Air you can just barely get 80 + 80 side by side if you full screen SFMono at like 12-14pt.
I’ll never sell my colleagues on it, but I’ve been playing around with setting the formatters to 1-space indent. It’s not as heinous as it sounds.
Bring it on! :P
- bee_rider 4y agoThe cool thing about tabs is that you can do that 1-space indent without spreading your madness (but yeah, I think I got a preference for 3 spaces -- actually tabs with tabwidth set to 3 -- while using a little, now old, netbook). One nice advantage of 3 space tabs is that if somebody mixes tabs and spaces in Python, leading to mysterious IDE-dependent bugs, it immediately sticks out (my example is from helping student in an intro to python class, hopefully this doesn't occur much in the real world).
- Izkata 4y agoHoly crap I'm not the only one that likes 3...
- benreesman 4y agoWe've just gone the deterministic code formatter route on everything. Right off the top of my head: - C/C++: `clang-format` is great - Rust: `rustfmt` is very good - Python: `yapf` is very good - Java: `google-java-formatter` is pretty good - Haskell: `fourmolu` is OK, and if you apply it first and then `stylish-haskell` it's good enough - Starlark - `buildifier` is great - Shell: `shfmt` is pretty good - Nix: `nixfmt` is pretty good I haven't done any JS or TypeScript or golang in awhile, but I'm sure there are great options there too. By having all the auto-formatters, we can have one golden config that's fully deterministic for upstream, but everyone can have their own if they want and it just gets blasted into the "golden" format before code review. Finally, a world without brace wars! Everyone tabs and spaces and whatever to their hear's content. Everyone's happy! * you do eat the blame getting fucked up the one time. it's worth it.
- Oreb 4y agoI prefer around 80 characters per line maximum even on very large displays. More columns of text are always better, and I also find shorter lines easier to read.