Next: , Previous: , Up: ref-mod   [Contents][Index]


4.11.8 The Type-in Module

The type-in module is the module that is taken as the source module for goals typed in by the user. The name of the default type-in module is user. That is, the predicates that are available to be called directly by the user are those that are visible in the module user.

When debugging, it is often useful to call, directly from the top level, predicates that are private to a module, or predicates that are public but that are not imported into user. This can be done by prefixing each goal with the module name, as described in ref-mod-vis; but rather than doing this extensively, it may be more convenient to make this module the type-in module.

The type-in module can be changed using the built-in predicate set_module/1; for example,

| ?- set_module(mod).

This command will cause subsequent goals typed at the top level to be executed with mod as their source module.

The name of the type-in module is always displayed, except when it is user. If you are running Prolog under the editor interface, then the type-in module is displayed in the status line of the Prolog window. If you are running Prolog without the editor interface, then the type-in module is displayed before each top-level prompt.

For example, if you are running Prolog without the editor:

| ?- set_module(foo).

yes
[foo]
| ?- 

It should be noted that it is unlikely to be useful to change the type-in module via a directive embedded in a file to be loaded, because this will have no effect on the load—it will only change the type-in module for commands subsequently entered by the user.



Send feedback on this subject.