5 ms·
I wasn't going to jump into this because arguing tabs vs spaces feels like a parody at this point, but I think you're correct. I started using spaces for inden
by begriffs 8y ago
I wasn't going to jump into this because arguing tabs vs spaces feels like a parody at this point, but I think you're correct.
I started using spaces for indentation just because I worked with people who did that. I kind of forgot I was even doing it because vim's auto-indent did a lot of the work, but after some time I realized spaces don't make sense.
The familiar arguments for tabs:
* Clean mapping between the concept of scope depth to a single character
* Configurable display of indentation width, everyone can see what they want
Tabs have problems only when people use them for alignment, which breaks when tabwidth is changed.
Actually can someone try to change my mind? I know tabs-vs-spaces is an eternal war, yet I feel the problem is completely solved, hence I must be ignorant of the counter arguments.
(The only thing more logical than using tabs might be using no whitespace at all and having the editor determine presentation. But that wouldn't work well with line-oriented tools.)
- mjevans 8y agoIt's only even a problem if tabs and spaces are mixed; if EVERY level of indent were denoted by a tab then it wouldn't really matter if the default editor width were 2, 4, or 8 or any other number as it would still be consistent in that editor.
- saagarjha 8y agoSpaces are only used for alignment at the very end, so the alignment should be consistent even when tab sizes are different because the base alignment, which is done with tabs, is the only thing that changes.
- RHSeeger 8y agoIf you're trying to align text, then even 2 would fail when the thing you're trying to align with is an odd number of characters (name of a method, etc).
- mjevans 8y agoAbsolute alignment and level of indent dependent code are two separate tasks. The former is a pre-formatted fixed-width character document that can only be viewed one way. The latter is a document which is easily processed; editors should show the intended logical representation of the information according to user preferences for conveying such meanings (though for terminal compatibility they often default to either 8 or 4 fixed width spaces in less powerful editors; still the meaning is conveyed clearly).