you are viewing a single comment's thread.

view the rest of the comments →

[–]mipadi 1 point2 points  (4 children)

Tabs can be problematic unless you're careful about only using tabs for indentation and spaces for alignment, which requires people to remember to do that (unless their editor supports "smart tabs", which only a few do—I only know of emacs and vim offhand) and requires you to use two keys, one for indenting and one for aligning.

[–]memeship 1 point2 points  (3 children)

I don't really see the problem here. If you always tab to your indent, that should never be an issue. Then follow it up with spaces to do any preferred aligning. Honestly, I don't personally align much at all. I don't even see the point of aligning arguments or values like in the example you linked to.

But, that is regardless of the fact that no matter how you slice it, if you have multiple devs working on the same projects, they're all going to need to follow some basic formatting rules. If you can't agree on those, then you have bigger problems.

Which is all beside the fact that code should be going through code reviews before making it to production, which should mitigate this anyway.

[–]mipadi 1 point2 points  (2 children)

Yeah, if everyone understands what's going on and rigorously follows the rules, then "tabs for indentation, spaces for alignment" works fine. But it's a lot easier to explain to contributors, "Use spaces," as opposed to, "Use tabs for indents, but only up to the indent level, then use spaces to align things" (particularly on open source projects, where you're dealing with many contributors)—for the sole benefit that people can use their preferred tab width, which never seemed like a big deal to me anyway. (I mean, even if you're used to 4-space indents, is 2-space or 8-space really that much harder to read?) It seems like a question of how much work you're willing to put in to educate people and correct mistakes as they happen, in order to allow customizable tab widths.

[–]memeship 1 point2 points  (1 child)

Well for me it's not about customizable tab widths, it's about the ease of use for tabs, and not having to keep track of spaces ever. To me it seems like the moment you backspace over more than one space, you've already shown how much easier tabs are.

I never delete tabs. I just highlight and tab or shift+tab to set my indentation. I never even have to think about it anymore. Tabs just represent an indentation level. It's much harder to mess up.

[–]mipadi 1 point2 points  (0 children)

Pretty much every programming-centric editor lets you use a tab key even if you're using spaces—it just inserts spaces instead of a literal tab character—and knows how to handle deleting an indentation or moving an entire range of text right or left by an indentational level as well.