Hacker News new | ask | show | jobs
by johnswamps 6269 days ago
I've always viewed this as a plus for tabs. Personally, I think two spaces is too small. If I'm looking at someone's code and it's hardcoded to two space indentation, I'm screwed. But if it's using tabs, I can set it to whatever I want. Some people like 2, some 4, and some 8. I prefer to use tabs to denote logical indentation, and then space for formatting. But not many people agree with me, so I usually just use spaces.
1 comments

Generally I agree, but for the pedantic there are other issues. Tabs at the beginning of lines aren't a problem. But, for example, it's common to see multi-line declarations of, let's say, a hash where each line looks like this:

key <tab> => <tab> value

This might look perfectly fine for someone using 8-width tabs, but it will most likely be screwy for anyone using 4-width tabs or smaller. The tab's location is calculated as the distance where the cursor position modulo the tab width is 0.

E.g. one key is 2 chars long and another is 5 chars long. You tabbed it using 8-width tabs. Looks fine. If someone loads it with 4-width tabs, they see the two lines aligned differently.