]> Repositorios git - scryer-prolog.git/commitdiff
Add preliminary current_module/1 predicate definition requiring a bound argument
authorPaulo Moura <[email protected]>
Fri, 24 Sep 2021 09:13:00 +0000 (10:13 +0100)
committerPaulo Moura <[email protected]>
Fri, 24 Sep 2021 09:13:00 +0000 (10:13 +0100)
src/loader.pl

index 0b725a409cc0ddd875043f02a6e738ea26dcc497..8ab46bf054acb51b6d593f2c8463761953e4956b 100644 (file)
@@ -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.