4 ms·
It’s not the concept of indentation that’s the problem, it’s the implementation. Tabs vs space, smart editors, auto-linters all make it easier or more difficult
by tasogare 6y ago
It’s not the concept of indentation that’s the problem, it’s the implementation. Tabs vs space, smart editors, auto-linters all make it easier or more difficult depending on the situation, which created insecurities by constantly breaking expectations. In case of code, the fact there is not visible difference (most of the time) between tabs and space make it quite easy for bugs to creep in.
- unionpivo 6y agothat's why it's spaces only. If you mix you are asking for trouble, and if you allow to be configured, half will pick one the other will pick other. So the only sane choice is to just pick one and enforce it. And by now most of the editors have python rules baled in, so it's not big problem in practice. By python standard one level is exactly 4 spaces
- thechao 6y agoRight. Also, for those language designers trying to figure out if the right white space is 'tab' or 'space', just do a quick DDG for 'tab' and 'Makefile'. The answer is space.
- franga2000 6y agoAre your referring to the fact that Make requires tabs to indent blocks of commands? It's not even whitespace in that case - Makefile treats the character as a prefix. Sounds like it would be even worse if it required 4 spaces... I actually see Make's use of tabs a great example of why they make more sense for indentation, especially when it matters. 1 \t => +1 level of indentation. No guessing the number of spaces and praying it stays consistent throughout the file.
- thechao 6y agoI don't disagree with you from a language-designer point-of-view: it's an elegant, indentation-agnostic solution. The problem is that after explaining -- for the 50 gajillionth time -- that "it's a tab, not X spaces", I get a little frustrated.