[Haskell] Re: Use of tab characters in indentation-sensitive code

Ronan Klyne ronan at ninebynine.org
Mon Jan 26 03:53:08 EST 2004


I support the idea that somthing should be done. I would like to suggest 
that the compiler references an environment variable to determine how many 
spaces a tab represents. I realise that this would cause the same code to 
run on some systems and fail on others, but it would allow a developer to 
set up a comfortable working system without tab characters ruining the 
logic of a program.

	# r

On Sat, 24 Jan 2004 18:29:46 +0100, Wolfgang Thaller 
<wolfgang.thaller at gmx.net> wrote:

> Graham Klyne wrote:
>
>> I think that compilers should issue a warning when indentation that
>> determines the scope of a construct is found to contain tab characters.
>
> I'd say, when it "is found to contain a mixture of tab and space 
> characters".
> I have successfully written a lot of Haskell code that uses tabs 
> *exclusively* - in that case, the meaning of the program *doesn't* 
> depend on how the tab characters are interpreted.
> IMHO, there should only be warnings about tabs when their size makes a 
> difference to the meaning of the program, as shown in the examples below:
>
> let
> <spaces>x = 1
> <TAB--->y = 1	-- warning
>
> let
> <TAB--->x = 1 -- OK
> <TAB--->y = 2 -- OK
> <spaces>z = 3 -- warning
>
> a = let x = 1
>          y = 2 -- OK
> 	in ...
>
> b = let x = 1
> <TAB--->y = 2 -- warning
>      in ...
>
> There are many editors that automatically mix tabs and spaces in 
> indentation (and I don't like that - what's it good for?), but some 
> people will certainly want to continue to use them, so I'm not sure if 
> adding warnings like these would be acceptable to them.
>
> Cheers,
>
> Wolfgang
>
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell


More information about the Haskell mailing list