[m-rev.] for review: diff algorithm

Julien Fischer jfischer at opturion.com
Fri Dec 21 15:10:22 AEDT 2018

Hi Zoltan

On Wed, 19 Dec 2018, Zoltan Somogyi wrote:

> 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.

I think that it's general for the standard library; if other users have
issues with the performance they can be addressed then.

> 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.

That's fine if the new module is part of the compiler; if it's part of the
standard library module then it should have a dedicated test case, or
test cases, that are independent of the compiler.

I had a look through the code and could not see anything obviously


More information about the reviews mailing list