[erlang-questions] Controversial subject of the day: tabs and spaces for indentation
Geoff Cant
nem@REDACTED
Mon Feb 10 23:22:17 CET 2014
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[1]. 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.
Opinionatedly,
--
Geoff
[1] If you pick 16, that's cool - I'll probably just fork your library.
More information about the erlang-questions
mailing list