Changes between Version 1 and Version 2 of Tabs

Dec 2, 2005 3:34:39 PM (12 years ago)
Simon Marlow


  • Tabs

    v1 v2  
    33Many newbies seems to get their Haskell code layout wrong because their editor uses tab stops that are not 8 spaces wide.  The code looks to them exactly as if it were correctly aligned, but according to the Haskell Report it is not.  A reasonable proposal would be to outlaw tab characters in source code altogether.  Always use spaces for indentation.  Most editors can automatically convert from tabs to spaces, and it is better to alert the newbie programmer with a lexical error "tab not permitted", than to leave it to either the parser, or worse, the type system, to complain about something incomprehensible later on.
     5=== Alternative ===
     7[added by Simon M] An alternative suggestion is the following: make it an error if the meaning of any layout depends on the width of a tab character.  Adopting this style in source code is already recommended in the report (section 9.3, "to avoid visual confusion..."), the proposal is to change this guideline into a requirement.
     11 * small change to the language
     12 * breaks very little code
     13 * allows tabs of any width to be used, and code created using one tab width still has the same meaning when viewed with a different tab width
     17 * more complicated to explain than just disallowing tabs altogether
     18 * more to implement