# Modules - explicit \`reexport\` of operators

**URL:** <https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724>\
**Category:** Help!\
**Created:** [January 11, 2025, 6:02pm UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724 "2025-01-11T18:02:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ridgeworks](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ridgeworks/32/886_2.png) [@ridgeworks](https://swi-prolog.discourse.group/u/ridgeworks)\
**Post date:** [January 11, 2025, 6:02pm UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724/1 "2025-01-11T18:02:13Z")

</div>

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

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

```

generates a warning something like:

```prolog
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?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [January 12, 2025, 9:08am UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724/2 "2025-01-12T09:08:07Z")

</div>

> [@ridgeworks](#):
>
> `op/3`

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

---

<div class="post-metadata">

**Author:** ![ridgeworks](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ridgeworks/32/886_2.png) [@ridgeworks](https://swi-prolog.discourse.group/u/ridgeworks)\
**Post date:** [January 12, 2025, 2:49pm UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724/3 "2025-01-12T14:49:07Z")

</div>

This:

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

```

generates:

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

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [January 12, 2025, 4:27pm UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724/4 "2025-01-12T16:27:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ridgeworks](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ridgeworks/32/886_2.png) [@ridgeworks](https://swi-prolog.discourse.group/u/ridgeworks)\
**Post date:** [January 12, 2025, 5:48pm UTC](https://swi-prolog.discourse.group/t/modules-explicit-reexport-of-operators/8724/5 "2025-01-12T17:48:10Z")

</div>

> [@jan](#):
>
> Pushed a fix to allow using unification based patterns.

Thanks - will retest on next development release.
