If the compiler encounters a variable with the name __MODULE__ in the source then it replaces that variable with the name of the module being compiled at that moment. This can be useful for debugging Prolog programs as __MODULE__ can be used by debug predicates that write and/or log messages of a Prolog application.
see also: __FILE__ __HOST__ __LINE__
| Examples | |
| start( __MODULE__ ). | If the predicate start/1 is located in the module 'test' and
the goal 'start(X).' is proven then the variable X be unified with the name of the file. X = 'test' |