On Thu, Mar 5, 2009 at 8:52 AM, Jonathan S. Shapiro <[email protected]> wrote:
> This is the obverse problem, but there is a visual clue here: two
> statements not surrounded by curly braces should never be indented at
> the same level.
>
> And clearly we could run emacs and get the OCaml let bindings indented
> correctly. The right question: why is the OCaml community apparently
> failing to do so ten years later?

I think I can answer this question, as someone who will admit to have
their mind rotted by ocaml syntax (given the previous email). :)

The basic reason is that because ever variable binding in ocaml
introduces a new indentation level, a program that added extra spaces
every time you add a scope would quickly develop an absurd level of
indentation.  In other words, it would be like writing C code like
this:

    int x = 1;
        int y = 3;
            int z = 5;

Yes, you can do this with "and", but that is annoying in the sense
that if you write

    let x = 1
    and y = 2 in
        ...

you can't just delete the "int x = 1" line and get a valid program.
The result of this is that people end up using indentation to reflect
how _they_ think about the structure of a program, not how the
compiler is parsing it.  E.g., I consider the following to be
*correctly* indented:

    let f z =
        let x = 1 in
        let y = 2 in
            g x y z

Note: I'm aware you might strongly disagree, and am just trying to
explain how at least one ex-ocaml programmer thinks about ocaml
syntax.

Geoffrey
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to