Le Tuesday 03 Jan 2012 à 17:37:45 (-0500), Chris King a écrit :
> On Tue, Jan 3, 2012 at 4:36 PM, Guillaume Yziquel
> <[email protected]> wrote:
> > Conversely, choking on the semicolon would mean changing the language
> > itself.
>
> Not at all. "let a () = let p = 1; let a = 2; 3;;" is invalid and "let
> a () = let p = 1; 2 in 3" is valid whether the parser complains about
> the semicolon or about a missing "in". Delphin is not concerned with
> *when* the compiler complains, but rather with *what* it complains
> about.
Right.
> The holy grail of error reporting is if the compiler could report the
> smallest change (by some metric) necessary to cause the program to
> compile. I believe this is what Delphin is after. Unfortunately I
> believe this is very hard in practice!
In the following example:
let a () = let p = 1; let a = 2; 3;;
You've essentially got two syntactic rules that are unmet: lack of 'in'
for each one of the two 'let's. Guessing that the semicolon of 'let a =
2; 3' should in fact be an 'in' needs extra knowledge about the mistakes
the programmer can make. But that's really *extra* knowledge. So two
questions:
[1] Are there compilers around that really go this extra mile?
[2] Wouldn't you be concerned about making error messages less
predictable, as opposed to a plain and simple "doesn't match the
grammar" error? Some kind of breach of the principal of least surprise?
> - Chris
>
>
--
Guillaume Yziquel
http://yziquel.homelinux.org
--
You received this message because you are subscribed to the Google Groups
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html