[m-rev.] for review: better error messages for lambda exprs
Peter Wang
novalazy at gmail.com
Fri May 6 16:02:12 AEST 2016
On Thu, 05 May 2016 22:28:04 +1000 (AEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For review by anyone. If possible, I would like a review of the
> change to NEWS by more than one person.
>
> Like several of my diffs in the last few months, this one improves
> the error messages we generate for syntax errors, but restricts
> the set of legal Mercury programs. If anyone objects to the restrictions
> imposed by this diff, please speak up.
Hi Zoltan,
I object to the restriction.
Firstly, on the grounds of language design. IMHO Prolog syntax is well
designed, flexible and general. My feeling is that we should continue
on those foundations, so that any syntactically valid, well-typed data
term should be writable in a Mercury program.
Second, practically. Occasionally the Mercury language "takes over"
new words, sometimes common words like "event" and "for". For programs
that were using such words (or wish to), it would have been an annoyance
when the words were added to the operator table, but a relatively
minor annoyance as only simple names needed to be parenthesized. As I
understand it, this would no longer the case. Any future version of the
language may require some constructors to be renamed, not just make them
harder to type.
It can be convenient to use term syntax to persist data structures
(perhaps using custom operator tables to protect against new operators).
If a program is forced to rename a constructor then the data format would
implicitly change. To retain compatibility with an old constructor
name, the program would need to implement versions of term_to_type/
type_to_term that translate between the old and new names. That potential
for problems down the track detracts from the utility of the term syntax
(which, as I said, I regard as a good design).
Peter
More information about the reviews
mailing list