3 ms·
i've never understood why spaces are used for indentation, bit i've ended up adopting it because if everyone else is using spaces, i can't very well use tabs.
by pasquinelli 5y ago
i've never understood why spaces are used for indentation, bit i've ended up adopting it because if everyone else is using spaces, i can't very well use tabs.
there's, like, a message in there about life and society.
- ModernMech 5y agoI think it’s as simple as the fact that spaces are easy to hit with your thumb, and tabs are hard to hit with your pinky. At least that’s why I do it!
- gpsx 5y agoI think the role of a tab in a code editor is different from the role of a tab in a document editor. I have always used dedicated code editors and prefer tabs (but like you, I use and specify spaces for code style). I think people who use editors that are multi-purpose generally see these alternate usages of tab as problematic or even illogical. I think this is often the linux people, and they are often the most experienced and influential coders. I think that is why spaces are generally seen as the preferred method.
- toddh 5y agoBecause everyone has tabs set differently, so code always looks wrong, even if you use the same editor. A space is a space is a space.
- kevincox 5y ago> always looks wrong Only if you are mixing tabs and spaces in a strange way. If you use tabs reasonably then it looks right to each user's preferences. I think the reason that spaces are popular are that it is more obvious when done wrong. We should probably just have better code review tools that highlight when tabs are used for anything but initial indentation. It is as simple as /[^\t]\t/. The other downside of tabs is that you don't have a well defined line width, but IMHO line limits are a fairly silly lint anyways, you should make the code look reasonable. I find that formatters based on line length limits tend to make code very awkward to read.