Hacker News new | ask | show | jobs
by davelnewton 3680 days ago
Because people view source files using a multitude of means, and getting everybody across all their respective platforms to set things up is onerous.

When you mix tabs and spaces there's no way to get alignment correct. Indentation is fine, if that's all you ever use them for, but human behavior is non-deterministic and unenforceable, making for completely hosed up source when tabs are used for anything other than pure indentation. E.g., if you put a tab in for alignment, when you should have used spaces, your source file is hosed up.

Add on to that that many IDEs, editors, and build tool/tool hooks aren't smart enough to know when something is being indented vs. aligned, it's essentially impossible.

1 comments

I don't talk about mixing spaces and tabs. I talking about why don't we indent with tabs only? Spaces are good for separating tokens in code, but indentation is not for that - indentation is for making the structures visible, sometimes it is easier to read with smaller amount of indent, sometimes it is easier to read with larger amount of indent - based on my experiences. Why then to make the coders life worse than needed? (On the other hand I do like Go's approach for this: using 'go fmt' you can make your source file well-indented/aligned. sigh
You cannot use tabs for alignment, and people align things.