AW: Editor Tab Expansion

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
Fri, 6 Dec 2002 15:40:19 +0000 (UTC)


Fri, 6 Dec 2002 12:09:46 +0100, Ingo Wechsung <iw@contexo.de> pisze:

> No. My editor produces the ASCII code for horizontal tab, when I
> hit the tab key.  Just as it produces the ASCII code for a when I
> hit the a key.
> 
> That's how it should be.

It shouln't, becase tabs are 8 spaces, which is too much for
indentation of programs in most languages.

> The real problem is, that nobody could tell from just looking at
> the screen, what a program means even if you know the layout rules
> very well.

Of course I can.

If you can't, perhaps you are using a non-standard tab width?
Please fix settings of your editor and it will work.

> Instead, your text editor displays some space in place of the tab.
> Only if the expansion rules of your editor are compatible with
> Haskell's may you grasp the source codes meaning.

But they are compatible because there is one most universally accepted
interpretation of a tab (move to the next multiple of 8 columns). Any
other interpretation hampers portability and should be avoided.

> Think of a software development team. One member (in India)
> uses "convert n leading spaces to tabs", the other (in Japan)
> "convert leading tabs to m spaces". Everytime one of them makes a
> small change in a file that has been changed by the other before,
> the source code control system will have a huge diff.

All these problems are caused by people who use a different tab size
than 8. With consistent tab size there is no reason to convert between
tabs and spaces.

-- 
  __("<      Marcin Kowalczyk
  \__/     qrczak@knm.org.pl
   ^^    http://qrnik.knm.org.pl/~qrczak/