5 ms·
Why do you want to end up with spaces? Consider the alternative: if you end up with a tab, what's the downside?
by hboon 14y ago
Why do you want to end up with spaces? Consider the alternative: if you end up with a tab, what's the downside?
- drcyrusflame 14y agoOther coders you might be working with on the same project may be using a different editor with different tab-width settings which may lead to improper indentations making it hard to read the code.
- dragonwriter 14y agoWhat I'd generally prefer is tabs (keyed and stored) for block-structure indententation, and spaces for visual alignment of single logical expressions broken into multiple lines for readability (where you are aligning the following lines with some element of the preceding line.) This, incidentally, will preserve correct relative indentation regardless of tab settings in editors (it would even work for python, since you only have the first kind of indentation in python given python's indentation sensitivity, but the convention of spaces-over-tabs is so strong in Python that its not worth debating, given how much higher the cost of inconsistency is compared to the cost of choosing the less-ideal option consistently.)
- lutusp 14y ago> if you end up with a tab, what's the downside? The downside is that different environments (and different languages) will interpret the tab differently. Not so for spaces. This is not usually an issue unless both tabs and spaces are used in the same file, and that was my qualifier.
- petercooper 14y agoConsistency. Sometimes I might use tab, sometimes I might notice something's off by one and use a space (for right or wrong, habits + muscle memory etc.) I also use code from other developers who may be even more inconsistent or pick one over the other. If everyone just uses spaces - as in common in the worlds I work in - a lot of the above issues are prevented.