3 ms·
The best reason I've seen for tabs is this one [0], where there were two people working on the same code base with different visual impairments, where one perso
by TJSomething 5y ago
The best reason I've seen for tabs is this one [0], where there were two people working on the same code base with different visual impairments, where one person needed 1 space tabs with a very large font and the other had to use 8 space tabs with a very wide monitor. You can't get that functionality if you assume any tab width.
[0] https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/ https://www.reddit.com/r/javascript/comments/c8drjo/nobody_t...
- kazinator 5y agoI read that bit about the two developers also. It was never explained what the 8-space indent person's visual impairment might be; I suspect that it's a field of vision problem: difficulty tracking vertically between distant elements that are expected to be at the same indentation level. Editors can help here by rendering some vertical lines to guide the eyesight. Nobody should have to resort to huge tabs because of a vertical tracking problem. I really think solving the adaptive indentation problem with tabs is a nonstarter. You have to adapt the tools to the reams of existing code, not vice versa. The editor, in combination with recognizing the syntax of the language to some extent, could treat leading indentation spaces in a flexible "tab like" way. Indentation that is excessive to the visually impaired developer could be reduced by assigning fractional widths to just leading spaces, like 1/8, 1/4 or 1/2 a cell. The editor has to separate indentation spaces from alignment spaces for this purpose. Another approach could be that, quite simply: the editor groks the indentation and renders it flexibly. It deduces that a certain line of code is three levels indented and then renders that however the user wants, regardless of whether the three levels come from three tabs, 24 spaces, or a mixture of tabs or spaces or whatever. If the editor knows that two space indentation is in effect, and some line with 30 spaces is deduced to be at four indentation levels, then it knows that eight spaces of that line are rendered as abstract indentation, and the remaining spaces are literal, for alignment. This is not some Hard Problem in software where we have to throw our hands in the air and conclude that the only way is to achieve the requirements is to have tabs in the data.
- mark-r 5y agoThese days our editors are already doing a huge amount of parsing of our code. I know I've seen one editor, probably Visual Studio, that can determine your nesting level and draw vertical lines to delineate it.