
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

On Sun, Aug 25, 2002 at 05:31:21PM -0700, Ashley Yakeley wrote:
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. ...
There's an alternative viewpoint I was trying to suggest, but probably wasn't clear enough: tabs and spaces are incomparable, and it is an error to try to compare them. That is, the whitespace at the beginning of adjacent lines of layout has to be exactly the same, not just end up at the same goal column. Similarly, if line 2 is indented more than line 1, than the whitespace at the beginning of line 2 should start with the identical whitespace to line 1. This will still sometimes break from the user's point of view, but at least it breaks immediately and visibly, and would never break silently. --Dylan

Hi, I think we should simply drop this subject. The width of tabs is, as far as I can see, quite irrelevant for i18n. The Report specifies 8, and you can of course try to get that changed, simply ignore it, start using spaces instead, or whatever. But I don't think it is a discussion that belongs on this list, and it seems to generate more heat than light at the moment. -kzm -- If I haven't seen further, it is by standing in the footprints of giants
participants (3)
-
Ashley Yakeley
-
Dylan Thurston
-
ketil@ii.uib.no