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

Bengt Kleberg bengt.kleberg@REDACTED
Tue Feb 11 07:16:26 CET 2014


Greetings,

Is it not difficult to preserve alignment when using both variable width
characters and fixed width characters tools?


bengt

On Tue, 2014-02-11 at 14:17 +1300, Richard A. O'Keefe wrote:
> 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
> 
>     my_function(
>         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
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list