Modules - explicit `reexport` of operators

It appears that operators cannot be explicitly re-exported as in

:- reexport(someModule,[op/3]).

generates a warning something like:

Warning:    import/1: system:op/3 is not exported (still imported into someModule)

and any operators remain globally undefined, as the message suggests. But if the whole module is reexported, the operators are exported as well (which is a useful workaround).

Bug or feature?

I don’t recall whether it works, but this reexports the predicate op/3. The syntax should be op(_,_,_) as with use_module/2 for importing operators. Using this syntax, use_module/2 imports all operators that unify with this term. For example

 :- use_module(m, [p/1, op(_,_,::)]).

Would import :: as operator, regardless of its priority and associativity (which may import it as e.g., prefix and infix operator).

1 Like

This:

:- reexport(m,[op(_,_,_)]).  % for operators

generates:

ERROR:    op/3: Arguments are not sufficiently instantiated

If all 3 arguments are instantiated, it works. But the whole point was to reexport the existing op definition from another module.

I can also work around this by reexporting everything “except” the non-operators.

This can’t be right of course :slight_smile: Pushed a fix to allow using unification based patterns.

Thanks - will retest on next development release.