3 ms·
If the tab people would reliably use tab for leading indent and space for further alignment, I'd be 100% on board. But what happens in practice is that the fil
by js2 10y ago
If the tab people would reliably use tab for leading indent and space for further alignment, I'd be 100% on board.
But what happens in practice is that the file ends up with a mish-mash of tabs and spaces throughout and the file is only legible if you set your tab stop to a specific setting, and sometimes not even then because different authors have used different tab stops for both indentation and alignment. At which point the tabs buy you nothing.
So just use spaces and be done with it. Or go fmt. :-)
- __s 10y agoAs a tab person, I don't line up code. Each line may decide to unindent, indent, or maintain indentation Here's some Befunge interpreters in a few different languages: https://github.com/serprex/Befunge https://github.com/serprex/Befunge
- sethish 10y agoIn an argument of tabs vs spaces. Someone always says both. You are that person.
- minitech 10y agoBut the argument really is both vs. spaces. Anyone using tabs for alignment is doing it wrong.
- d0lph 10y agoI think it would not be hard to create a git hook that checked and fixed inconsistent tabbing. As someone who tabs, 4 is a very common standard, and consistency has never been a problem.
- frandroid 10y agoIn our project, we use ESlint to check for this kind of stuff. For a while we had it forcibly fix indentation and minor bugs but some devs didn't like it so now it just warns you. I thought it was amazing.
- mixedCase 10y ago>If the tab people would reliably use tab for leading indent and space for further alignment, I'd be 100% on board. There is no other way to do tabs. Anything else is simply wrong and grounds for execu... a stern talking-to.
- donny2015 10y agoI wonder what's wrong with people today. Just use spaces, any descent text editor inserts 4 or 2 spaces on pressing tab, and nobody has any problem.
- Stratoscope 10y agoThere is another alternative. At the risk of repeating what I've mentioned elsewhere in the thread, this is to not use column alignment at all. Simply use indentation in the places where you might be tempted to start lining up columns. It's really easy to use an alignment-free style. A good way to get in the habit is to code in a proportional font instead of monospaced. By doing that, you won't be able to use column alignment, and you'll naturally gravitate toward using indentation to represent the block structure of your code.
- marssaxman 10y agoI use tabs for indentation. I don't desire or care about column alignment. Code that has carefully-laid-out column alignment feels bizarrely fiddly to me - it's like the fad for absurd giant ASCII boxology comment headers back in the late '80s. Why bother? What's it adding?