Exported module predicate and alternate goal expansion

Hello,

i have a module that offers a number of predicates for export. Some essentially forward a call to another module, as so:

:- module(m_1,[
pred1/1
]).

  pred_m_1(X) :-
            pred_m_2(X).

During debugging / tracing I want to keep to the forward call as above. However, during regular run I want to replace the indirect call with a goal expansion such as so:

:- if(tracing).
pred_m_1(X) :-
pred_m_2(X).
:- endif.

:- if(+ tracing).
goal_expansion(pred_m_1(X), m_2:pred_m_2(X)).
:- endif.

However, the above doesn’t work because once expanded the exported predicate in the module is missing. I am therefore getting a Exported procedure pred_m_1/1 is not defined error.

Is there a way to overcome this issue.

thanks,

Dan

Just leave the predicate there? You can also have a conditional export declaration or use :- export to export (conditionally).