[mercury-users] Ambiguity

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Dec 10 20:00:47 AEDT 2008


On 10-Dec-2008, Michael Day <mikeday at yeslogic.com> wrote:
> Recent versions of the Mercury compiler (eg. from end of 2007 onwards) are
> giving us a lot of trouble with ambiguity. Some modules we cannot compile,
> as a particular predicate has excessive ambiguity including things such as
> ++ applying to either lists or strings, 'no' being either a bool or a
> maybe(T), and so on.
>
> We've tried bumping up the ambiguity error limit, but once it goes beyond
> about 100000 no errors are produced, but compilation of the opt file still
> fails with an empty err file produced.
>
> This is hugely annoying, as it requires renaming hundreds of symbols to try
> and reduce the ambiguity in modules that compiled fine in earlier versions
> of the compiler (eg. 2006-07-16).
>
> Is there a way to tell the compiler to stop complaining about ambiguity and
> just get on with it? If it results in lengthy compile times or excessive
> memory usage we can always choose to interrupt it.

Increasing the value of the --typecheck-ambiguity-error-limit parameter
(as opposed to --typecheck-ambiguity-warn-limit) IS the way to tell the
compiler to get on with it.

My first guess for why you get a seemingly-silent failure is that the
compiler is running out of heap. The Boehm collector will print a message
about "out of memory, returning nil" when this happens, but the message
may not end up where you look for it. My second guess is that the typechecker
is exhausting the stack when iterating over that many type assignments.

If the problem is neither of these, I think you will need to give us
a test case we can work on.

You may be pleased to know that last week, a summer student started working
with us on constraint-based type analysis, whose main objective is to
eliminate this kind of worst-case behavior. He could use your test case
as a motivating example.

Zoltan.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list