33 ms·
Why spaces and not tabs for indents? I know this conversation has probably been had many times before. But if I prefer a 2 space tab, and you prefer a 4 space
by benj111 4y ago
Why spaces and not tabs for indents?
I know this conversation has probably been had many times before. But if I prefer a 2 space tab, and you prefer a 4 space tab, we both get them how we want them with tabs.
With spaces, I have to put up with your stupidly wide indents, and try not to scratch my eyes out from the pain.
- resizeitplz 4y agoA question as old as time (or as old as the existence of code editors). 4k results on Hacker News alone - and surely thousands, if not millions more, across the internet. There is no right answer, just differing preference. https://www.google.com/search?q=spaces+vs+tabs+site%3Anews.ycombinator.com https://www.google.com/search?q=spaces+vs+tabs+site%3Anews.y...
- incrudible 4y agoGetting over these pet peeves is one of the best skills you can acquire as a programmer.
- stcroixx 4y agoAgreed. The next challenge is getting over the annoyance every time someone wants to debate this AGAIN.
- postalrat 4y agoTime to turn off linters. Seriously your linting rules suck.
- incrudible 4y agoIf you're unironically linting whitespace you need to get your priorities straight.
- eru 4y agoWhy? Sticking your whitespace rules in the linter is a great way to keep them from taking up valuable time and attention in (human!) code review.
- deleted 4y ago[deleted]
- incrudible 4y agoYou will pay for it in wasted time and nerves on fixing whitespace warnings just to make the linter shut up.
- eru 4y agoUse an auto-formatter.
- incrudible 4y agoIf you use an auto-formatter then just run that before you check in your code instead of setting up redundant linter rules that run every time you compile.
- eru 4y agoYou set up the linter to run as a check for pull-requests. What people do locally to pre-emptively comply with the pull-requests rules is up to them, like running the auto-formatter before they commit their code, or running the test suite before making a pull-request.
- incrudible 4y agoFair enough. The thing is, if you do not fuss about whitespace, none of that even comes up. Nobody needs to set this up, make the decisions, integrate it, deploy it, maintain it and then have everyone annoyed by it until they get used to it. The people who think we need such a system are the ones I do not want on the team, because odds are that they are nitpickers whose peculiarities permeate their entire work. Brilliant people perhaps, but they better work on their own.
- MoSattler 4y agoWhile I share the preference for using 2 spaces, it seems unnecessary to focus solely on criticizing the formatting choices when someone has generously shared a wonderful project they created during their free time, available for all to enjoy at no cost.
- benj111 4y agoI think I may not have come across as intended. I personally would go for tabs. That seems 'obvious' to me. The author went a different route and I'm interested in their reasoning. As you say, it's a personal project they're giving away. My question was one of why they went in a particular direction, rather than saying that direction is wrong.
- pubby 4y agoFor languages with significant whitespace, mixing tabs and spaces can be very error prone. It can look like two lines of code have the same indentation, but if the compiler's tab width doesn't match yours it would not parse correctly. See Haskell for an example of what not to do.
- deleted 4y ago[deleted]
- entelechy0 4y ago[dead]
- mwcremer 4y agoset your tab stops to 1 space. problem solved.