5 ms·
The tabs and spaces thing is targeted at teams. At any point, there will be someone editing the makefile with a misconfigured editor. Depending on the team's gr
by jpollock 4y ago
The tabs and spaces thing is targeted at teams. At any point, there will be someone editing the makefile with a misconfigured editor. Depending on the team's growth rate, and their desire to use different tools, this happens a lot.
Avoiding tab vs spaces or tab width arguments is a good thing for any team to do. :)
- aslilac 4y agoYet this has been settled in Makefiles for a long time: use tabs. OP only seeks to sit on a high horse about how tabs are bad and to divide an ecosystem which is already pretty consistent. I’m so tired of people insisting tabs are evil and that using them somehow makes you “wrong.”
- bee_rider 4y agoTabs are obviously superior. If the tabs vs spaces argument must be had, and the correct option somehow loses, then we will have a much more annoying followup argument about how many spaces (I vote for three spaces and I will filibuster).
- benreesman 4y agoSince 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.
- int_19h 4y agoYou can't meaningfully filibuster rustfmt / go fmt / Black / ... - that's the best thing about them.
- bee_rider 4y agoI mean, this is mostly joking, of course if I was on a team I'd put forward my argument once and then comply with the conclusion the group makes, it is not really a big deal anyway. Hopefully somebody wouldn't just apply an auto-formatter, that'd be quite rude!
- bee_rider 4y agoThis is good, their builds will fail, notifying them of their misconfiguration in the most obvious way possible. Hopefully they will have to customize the Makefile a little to build on their system, and give it a build before they start programming, so they can correct their editor before they do any damage to the source code.
- usefulcat 4y ago> This is good, their builds will fail, notifying them of their misconfiguration in the most obvious way possible. I think it's very funny that you think a build is guaranteed to fail in an obvious way due to a tab vs space problem.
- bee_rider 4y agoIt may not be obvious why it failed, but it should be obvious that it did fail.
- usefulcat 4y agoIf, for example, make fails to update a target that should have been updated, that kind of problem will frequently not be obvious.
- bee_rider 4y agoSure, it also won't catch the misconfiguration for those who don't even open the Makefile. It is too optimistic to hope that this venerable piece of software will solve all out misconfiguration woes, but at least it provides a possible red flag sometimes.