1:- module(def_modules,
    2          [ '$def_modules'/2
    3          ]).    4
    5:- module_transparent '$def_modules'/2.    6
    7% Warning: note that we still use system:'$def_modules'/2 inside this, since its
    8% output could change during the load of the module
    9
   10'$def_modules'(Preds, MList) :-
   11    '$current_source_module'(Source),
   12    strip_module(Source:Preds, M, PL),
   13    system:'$def_modules'(M:PL, MTail),
   14    ( '$defined_predicate'(M:'$module_expansors'(_, _, _)),
   15      M:'$module_expansors'(PL, MList, MTail)
   16    ->true
   17    ; MList = MTail
   18    )