From: Paulo Moura Date: Fri, 24 Sep 2021 09:13:00 +0000 (+0100) Subject: Add preliminary current_module/1 predicate definition requiring a bound argument X-Git-Tag: v0.9.0~41^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=490496f38188adcb374999f945c2a6a52319768d;p=scryer-prolog.git Add preliminary current_module/1 predicate definition requiring a bound argument --- diff --git a/src/loader.pl b/src/loader.pl index 0b725a40..8ab46bf0 100644 --- a/src/loader.pl +++ b/src/loader.pl @@ -8,7 +8,8 @@ prolog_load_context/2, strip_module/3, use_module/1, - use_module/2 + use_module/2, + current_module/1 ]). @@ -465,6 +466,14 @@ use_module(Module, Exports) :- ; use_module(Module, Exports, Evacuable) ). +current_module(Module) :- + ( var(Module) -> + instantiation_error(current_module/1) + ; \+ atom(Module) -> + type_error(atom, Module, current_module/1) + ; '$module_exists'(Module) + ). + %% If use_module is invoked in an existing load context, use its %% directory. Otherwise, use the relative path of Path.