11.3.50 current_module/[1,2]

Synopsis

current_module(?ModuleName)

Queries whether a module is “current” or backtracks through all of the current modules.

current_module(?ModuleName, ?AbsFile)

Associates modules with their module-files.

Arguments

ModuleName
atom
AbsFile
atom

Absolute filename in which the module is defined.

Description

A loaded module becomes “current” as soon as some predicate is defined in it, and a module can never lose the property of being current.

It is possible for a current module to have no associated file, in which case current_module/1 will succeed on it but current_module/2 will fail. This arises for the special module user and for dynamically-created modules (see ref-mod).

If its arguments are not correct, or if Module has no associated file, current_module/2 simply fails.

Backtracking

current_module/1 backtracks through all of the current modules. The following command will print out all current modules:

     | ?- current_module(Module), writeq(Module), nl, fail.

current_module/2 backtracks through all of the current modules and their associated files.

Exceptions

type_error

See Also

ref-mod-ilm.


Send feedback on this subject.