[m-dev.] promise declarations and module import scopes
jfischer at opturion.com
Fri Feb 7 16:34:03 AEDT 2020
The standard library's int module contains a number of ':- promise
declarations' in its _interface_, e.g.
:- promise all [A, B, C] ( C = B + A <=> C = A + B ).
If I import the uint module into the _implementation_ section then
I get ambiguity errors for those promise declarations, e.g.
int.m:487: In clause for `promise' declaration:
int.m:487: error: ambiguous overloading causes type ambiguity.
int.m:487: Possible type assignments include:
int.m:487: A: `uint' or `int'
int.m:487: B: `uint' or `int'
int.m:487: C: `uint' or `int'
(This presumably happens because the promise gets turned into a
predicate internally for semantic checking purposes and that checking is
occurring w.r.t the implementation imports.)
Obviously, promise declarations are not a documented feature and the
problem can be resolved by module qualifying the declaration.
I'm raising this issue because I am working on a change that is
(probably) going to result in the uint module being imported into the
implementation section of the int module.
More information about the developers