Use of tab characters in indentation-sensitive code
Sean L. Palmer
seanpalmer at verizon.net
Sat Jan 24 12:21:03 EST 2004
Why has HTML been out for many many years, and yet programming languages
still use plain ASCII text exclusively? Don't we have similar needs as
other electronic document manipulators?
Someone should decide on a subset of HTML that is intended for programming.
Then we could use *actual* indentation instead of tabs or spaces. It could
also unify or abstract away commenting style, moving it from the domain of
the language (lexer) to the domain of the layout protocol.
But if I stop the wishful thinking, Wolfgang is right. Tabs are ok so long
as they are used exclusively. In fact, if the tab size equals the indent
size, it makes it quite easy to *change* the indent size when the source is
worked on by various people with different indent preferences.
----- Original Message -----
From: "Wolfgang Thaller" <wolfgang.thaller at gmx.net>
To: <haskell at haskell.org>
Sent: Saturday, January 24, 2004 9:29 AM
Subject: Re: Use of tab characters in indentation-sensitive code
> 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
> 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
> <spaces>x = 1
> <TAB--->y = 1 -- warning
> <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.
> Haskell mailing list
> Haskell at haskell.org
More information about the Haskell