Outlaw tabs

Peter Hercek phercek at gmail.com
Mon Jan 26 09:49:02 EST 2009

Johan Tibell wrote:
> I do for the following reason: If you use only tabs for leading
> whitespace you loose the ability to align things. Here's and example
> using a list (view using a fixed width font):
> lst = [1, 2, 3
>        4, 5, 6]
> This definition uses alignment to align the first element on the first
> line with the first element of the second line. You can't do this kind
> of alignment using tabs.

Yes, most people use that style or its variations (e.g. when multiple 
assignments have the equal sign aligned somewhere in the middle of a 
line or comments are aligned at the end, etc). I do not because when I 
rename lst to myLst then I need to modify two lines (the second one to 
fix the alignment). Also I do not like that the change looks bigger in a 
text diff. I prefer:

lst = [1, 2, 3
   4, 5, 6]  -- fixed indent by two spaces regardless of previous lines

Or, if I really care about alignment at such a low level (which I almost 
never do):

lst =
   [1 ,2 ,3   -- fixed indent by two spaces
   ,4 ,5 ,6]  -- fixed indent by two spaces

For your style spaces are the only way to go, what I'm perfectly fine 
with. Actually whatever way this is resolved, I do not care. Just wanted 
to point out that there is a use for tabs at the line start ... now 
thinking it might have been an error :-)


More information about the Haskell-prime mailing list