layout rule infelicity

Ashley Yakeley ashley@semantic.org
Thu, 30 May 2002 03:18:16 -0700


At 2002-05-30 02:54, Lennart Augustsson wrote:

>If you look at C (& offspring), it's not the {;} that makes the code
>readable, it's the indentation that does.  So why not acknowledge that?

In C, the indentation is an important visual clue, but there are many 
different indentation styles. It's the braces that actually tell you the 
beginning and end of a block. I might also use indentation for 
non-blocks, for instance:

void foo (int n)
    {
    if (n > 0) bar
        (
        "Sproing!",    // title
        getBounds(n),  // bounds
        true,  // bordered
        true,  // bright
        false, // not transparent
        true,  // use v2 appearance
        5,     // shadow size
        null   // next
        );
    }

Equally, I always indent my braced blocks in Haskell as well as C (& o).

If you're used to braces, complicated Haskell expressions with layout 
look confusing, since it's not immediately clear which indentation style 
the layout rules are trying to enforce. It's also not clear to the 
unlearned how best to split an expression onto two lines, or how it 
interacts with parentheses, etc.

And then there are those nasty little infelicities...

-- 
Ashley Yakeley, Seattle WA