[erlang-questions] Controversial subject of the day: tabs and spaces for indentation

Richard A. O'Keefe <>
Tue Feb 11 02:17:05 CET 2014

Our message crossed.

On 11/02/2014, at 12:13 PM, Loïc Hoguin wrote:
> Indentation:
> myfunction(A, B, C,
>    D, E) ->
> Alignment:
> myfunction(A, B, C,
>           D, E) ->

I don't call that "alignment", I call that "evil".
As far as I am concerned, one of the core rules of
good indentation is
 - the presence or absence of line breaks will
   depend on the size of names and constants
 - but the AMOUNT of indentation never will.

Why?  Because indentation is supposed to reveal
STRUCTURE, not spelling.

I would write this as

        A, B, C, D, E
    ) ->

I know Lisp has traditionally used this style,
but I decided decades ago that it was wrong,
and I've never regretted it.

> But also, skipping the indentation that would be to the left of these assignments...
> No alignment:
> A = 1,
> Bartender = 17,
> Car = 35,
> Alignment:
> A         = 1,
> Bartender = 17,
> Car       = 35,

This I _do_ align, sometimes.  It's not a case where I would
ever have found tabs useful anyway.

I also try to align blocks of related end-of-line comments
so they start in the same column.  For that I used to use
tabs, but found it a pain.

> Hopefully it'll show up properly in the email.
> -- 
> Loïc Hoguin
> http://ninenines.eu

More information about the erlang-questions mailing list