Version française
Home     About     Download     Resources     Contact us    
Browse thread
ergonomie du compilateur
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hendrik Tews <tews@t...>
Subject: Re: ergonomie du compilateur
Hello,

I do occasionally program in ocaml. Since David Monniaux started
a discussion about the error messages of the ocaml compiler I
would like to add my opinion as well.

Features I dislike:

- There is no error recovery in the compiler. Before I start the
first compile I have at least 5 syntax errors in the file. In
order to find them I have to go through at least 5 edit-compile
cycles, which I find very annoying.

- In case of a syntax error, the compiler never reports what it
was expecting. For an ocaml beginner which has some experience in
SML it can be a tough problem to find the error in a line like

    type 'a tree = node of 'a * 'a tree * 'a tree
		 | leaf;;

since the compiler only says

    File "a.ml", line 3, characters 13-14:
    Syntax error

I would consider a message like "Expecting a Constructor, but
found an identifier" extremely useful.

- I don't understand the behavior of "ocamlc -i" if an type error
occurs. Especially in this case, where any information about the
inferred types would be useful, it just prints nothing. I would
like it to behave like the top-level, which prints any information
available. 


Regarding the type errors David Monniaux wrote:

   Couldn't the Ocaml compiler be made to have, on request, more verbose
   messages on typing errors, including the trace of inferences of the terms
   to cause problems?

I saw type inferences traces of other languages and it was no
help for finding a type error. Inference traces might be
interesting for people, who are interested in the typing
algorithm. 

Instead I would suggest an additional option to the ocaml
compiler which causes the compiler to print the types of all
identifiers not just those of top-level. This would help me a lot,
because I very often simulate the typing algorithm in order to
find the types of local variables which might have caused the
error.


Bye,

Hendrik Tews