
At 2002-08-25 14:42, Marcin 'Qrczak' Kowalczyk wrote:
Tabs are poorly suited for indenting because a tab has width 8 and this is at least twice too much for an indent unit for a functional language (i.e. lots of nested expressions).
Tabs are well suited for indenting because they're convenient and make the blocks line up easily. And you can set the tab width to whatever you want. Two opposing viewpoints, that you should not use tabs in source code at all -- http://adamspiers.org/computing/why_no_tabs.html ...and that you should tabs in source code, but only for indenting -- http://www.derkarl.org/why_to_tabs.html Both make the point that one cannot rely on tabs being set to any particular size. I'm closer to the second viewpoint, probably I ought to be using spaces rather than tabs to make things like line comments line up. I believe using tabs for indenting and then setting that to something other than eight is a reasonably common practice in other languages. Linus Torvalds has another view, for his Unix kernel "Linux" source: "Tabs are 8 characters, and thus indentations are also 8 characters." http://adamspiers.org/computing/Linus-Kernel-CodingStyle
Tabs must have a consistent width, because otherwise mixing tabs with spaces (which will always happen from time to time when several people are editing the same code) has fatal consequences.
Not in my Haskell! This is consequence of using layout, which I eschew in my own code. When you use braces and semicolons, the issue is much the same as for C or C++ or Java. I think I make about the same number of indentations in Haskell as I do in those languages, for instance. Obviously, like everyone else when working on someone else's code I follow their style. For layout, the language designers probably need to fix the tab width to something, and eight is the standard. So everyone has to use eight when using layout, or else not use tabs. From this it's easy to get in a mindset of "tabs are always eight", but that doesn't really represent the variation in this setting seen in other languages. When I first wrote Haskell and discovered my code didn't compile because the language itself made picky interpretations of whitespace, I was horrified. But I understand other people like it... Fortunately I can easily avoid the issue by using braces and I don't have to learn the layout rules either. -- Ashley Yakeley, Seattle WA