6 Modules
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Modules
        • Why Use Modules?
        • Defining a Module
        • Importing Predicates into a Module
        • Defining a meta-predicate
        • Overruling Module Boundaries
        • Interacting with modules from the top level
        • Composing modules from other modules
        • Operators and modules
        • Dynamic importing using import modules
        • Reserved Modules and using the `user' module
        • An alternative import/export interface
        • Dynamic Modules
        • Transparent predicates: definition and context module
        • Module properties
        • Compatibility of the Module System
    • Packages

6.10 Reserved Modules and using the `user' module

As mentioned above, SWI-Prolog contains two special modules. The first one is the module system. This module contains all built-in predicates. Module system has no import module. The second special module is the module user. This module forms the initial working space of the user. Initially it is empty. The import module of module user is system, making all built-in predicates available.

All other modules import from the module user. This implies they can use all predicates imported into user without explicitly importing them. If an application loads all modules from the user module using use_module/1, one achieves a scoping system similar to the C-language, where every module can access all exported predicates without any special precautions.