[erlang-questions] Controversial subject of the day: tabs and spaces for indentation
Tue Feb 11 00:09:17 CET 2014
On 02/10/2014 11:22 PM, Geoff Cant wrote:
> On 2014-02-10, at 14:12 , Loïc Hoguin <essen@REDACTED> wrote:
>> On 02/10/2014 11:01 PM, Richard A. O'Keefe wrote:
>>>> - Mixed tabs and spaces present challenges for programmer using
>>>> different editors and contributing to projects with varied or poorly
>>>> defined white space standards
>>> This is somewhat misleadingly phrased.
>>> Tabs do this all by themselves.
>>> For example, I once spent some time using a programming
>>> language where the IDE on Macs insisted that tabs were
>>> equivalent to 4 spaces and the Unix command line tools
>>> insisted that tabs were and could only be equivalent to
>>> 8 spaces, AND the language was indentation-sensitive.
>>> So remember, it's not "mixed tabs and spaces present
>>> challenges", it's "tabs present challenges".
>> Tabs are perfectly fine for indentation. You had issues only because you were doing both indentation *and* alignment. If you don't align your code, it doesn't matter what the tab length is.
>> Just like the CAP theorem, I posit the TIA theorem: tabs, indentation, alignment, choose two.
> Is there an argument in favour of jettisoning alignment in favour of tabs?
> I favour alignment over tabs, and am happy to work on other people's code no matter how many spaces they want for indentation. I have never once been glad that tabs-in-code let me choose my own indent level when viewing it - alignment has always been preferable as a mechanism for making code more readable.
One day not too long ago I decided to stop aligning entirely. Code is
still as readable as before, and I don't have to spend any time worrying
about prettifying the code (or fixing what the auto identation thing
did). Nobody said my code is less readable because of it so far.
I'm using tabs mostly for historical reasons, if I were to use spaces I
still wouldn't align.
More information about the erlang-questions