[m-rev.] for review: better error messages for lambda exprs
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed May 11 21:37:39 AEST 2016
On Wed, 11 May 2016 21:03:42 +1000, Paul Bone <paul at bone.id.au> wrote:
> If the compiler creates a type error for a term involving a :- which is not
> a lambda expression, then in addition to the usual type error the compiler
> could print something like "Perhaps this is a malformed lambda expression."
> to tell the programmer why the compiler got confused.
The test case tests/invalid/lambda_syntax_error.m contains four malformed
lambda expressions. At the moment, its .err_exp file contains thirteen separate
error messages, most of which are of the form "undefined symbol `pred'/1"
or "the language construct `='/2 should be used as a goal, not as an expression".
This is confusing.
If you had to choose between (a) adding a clause to each of those thirteen error
messages that says "perhaps this is a malformed lambda expression", as Peter
proposes, and (b) replacing those thirteen messages with just four, one for
each malformed lambda expression, which is what my diff does, which do you think
would most Mercury programmers prefer?
And then there is the software engineering issue I mentioned previously:
requiring the typechecker to act like a parser as well is a bad idea.
Zoltan.
More information about the reviews
mailing list