make module user available by default to all other modules
This commit is contained in:
parent
63416fdc48
commit
29ffb152e5
@ -38,7 +38,7 @@ YAP pre-defines a number of modules. Most system predicates belong to
|
|||||||
the module `prolog`. Predicates from the module `prolog` are
|
the module `prolog`. Predicates from the module `prolog` are
|
||||||
automatically visible to every module. The `system` module was
|
automatically visible to every module. The `system` module was
|
||||||
introduced for SWI-Prolog compatibility, and in YAP mostly acts as an
|
introduced for SWI-Prolog compatibility, and in YAP mostly acts as an
|
||||||
alias to `prolog`.
|
alias to `prolog`. The `user` module is also visible to all other modules.
|
||||||
|
|
||||||
The YAP engine is always associated to a module, the current <em>source
|
The YAP engine is always associated to a module, the current <em>source
|
||||||
module</em> or <em>type-in module</em>. By default, all predicates
|
module</em> or <em>type-in module</em>. By default, all predicates
|
||||||
@ -837,6 +837,8 @@ expand_goal(G, G).
|
|||||||
recorded('$import','$import'(ExportingModI,ImportingMod,G0I,G,_,_),_),
|
recorded('$import','$import'(ExportingModI,ImportingMod,G0I,G,_,_),_),
|
||||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G0I).
|
'$continue_imported'(ExportingMod, ExportingModI, G0, G0I).
|
||||||
% SWI builtin
|
% SWI builtin
|
||||||
|
'$get_undefined_pred'(G, _ImportingMod, G, user) :-
|
||||||
|
'$pred_exists'(G, user), !.
|
||||||
'$get_undefined_pred'(G, _ImportingMod, G0, ExportingMod) :-
|
'$get_undefined_pred'(G, _ImportingMod, G0, ExportingMod) :-
|
||||||
recorded('$dialect',Dialect,_),
|
recorded('$dialect',Dialect,_),
|
||||||
Dialect \= yap,
|
Dialect \= yap,
|
||||||
@ -1249,6 +1251,8 @@ export_resource(P0) :-
|
|||||||
).
|
).
|
||||||
export_resource(op(Prio,Assoc,Name)) :- !,
|
export_resource(op(Prio,Assoc,Name)) :- !,
|
||||||
op(Prio,Assoc,prolog:Name).
|
op(Prio,Assoc,prolog:Name).
|
||||||
|
export_resource(op(Prio,Assoc,Name)) :- !,
|
||||||
|
op(Prio,Assoc,user:Name).
|
||||||
export_resource(Resource) :-
|
export_resource(Resource) :-
|
||||||
'$do_error'(type_error(predicate_indicator,Resource),export(Resource)).
|
'$do_error'(type_error(predicate_indicator,Resource),export(Resource)).
|
||||||
|
|
||||||
@ -1498,8 +1502,8 @@ All exported predicates from _ExportingModule_ are automatically available to th
|
|||||||
source module _ImportModule_.
|
source module _ImportModule_.
|
||||||
|
|
||||||
This innovation was introduced by SWI-Prolog. By default, modules only
|
This innovation was introduced by SWI-Prolog. By default, modules only
|
||||||
inherit from `prolog`. This extension allows predicates in any module
|
inherit from `prolog` and `user`. This extension allows predicates in
|
||||||
to inherit from `user`oe other modules.
|
any module to inherit from `user` and other modules.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
import_module(Mod, ImportModule) :-
|
import_module(Mod, ImportModule) :-
|
||||||
|
Reference in New Issue
Block a user