[m-rev.] for review: diff algorithm

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Dec 19 19:33:04 AEDT 2018


I want to improve the error message you get when there is
a predicate's declaration has a different arity than its definition.
At the moment, you get told that there an arity mismatch, but
the compiler gives no help with finding out which args the mismatch
involves. I want the compiler to output the diff between (a) the list
of arg types in the declaration, and (b) the list of arg types inferred
for the definition.

As a first step, I have written the attached diff module. Besides a review
of the module, I would like feedback as to whether I should add it
to the standard library, or just to the compiler.  For my intended purpose,
the quadratic nature of the algorithm does not matter, but for many other
purposes, it will.

If anyone wants to try out the module, the attached difftest.m may help.
I do not intend to commit it even to a test directory. The diff module would
be tested later by new test cases in tests/invalid for the arity mismatches
mentioned above, when I have written that code.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff.m
Type: application/octet-stream
Size: 12100 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20181219/ad549169/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: difftest.m
Type: application/octet-stream
Size: 5005 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20181219/ad549169/attachment-0001.obj>


More information about the reviews mailing list