Everything that is typed to the top level prompt happens in a module called the top level module. This module name is displayed in the prompt and the default is eclipse. Note that this module is in no way special. It is just the default for typing in queries, and it is initially empty. When a predicate is compiled from the toplevel, then it is defined in the top level module, e.g.:
[eclipse 1]: [user]. p(hello). user compiled traceable 40 bytes in 0.00 seconds yes. [eclipse 2]: get_flag(p/1, definition_module, M). M = eclipse yes.The call to get_flag/3 tells us that p/1 is defined in module eclipse. The top level module can be changed by using module/1:
[eclipse 3]: module(mymodule). warning: creating a new module in module(mymodule) [mymodule 4]: p(X). calling an undefined procedure p(X) in module mymoduleSince mymodule did not exist previously, it is automatically created. The predicate p/1 that was defined in module eclipse is not visible in mymodule, the attempt to call it results in an error message.
Similarly, when a file is compiled from the toplevel, and the file does not contain any module directives, then its content is compiled into the top level module.