[ ECLiPSe Module built-in.|Group Index| Full Index]

module(+Module)

Open and enter a module, ie. set Module as the home module for the top-level loop and for subsequent compiled predicates.

+Module
Atom.

Description

When module/1 is typed from the top level, Module becomes the new top-level module. If the module was not defined yet, the module is created. All the following querries will be executed in that module. If the module was defined and locked, an exeption is raised

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Module is not instantiated.
(5) Type error
Module is not an atom.
(81)
This predicate must appear only alone as a directive.
(82)
Trying to access a locked module Module.

Examples


Success:
     [eclipse]: compile(user, m).
      p(X) :- writeln(X).
      user compiled 48 bytes in 0.03 seconds
     yes.
     [eclipse]: p(hello).
     calling an undefined procedure p(hello) in module eclipse
     [eclipse]: module(m).
     [m]: p(hello).
     foo
     yes.

Error:
    module(M).                 (Error 4).
    module(1).                 (Error 5).
    module(m), true.           (Error 81).
    module(a_locked_module).   (Error 82). % from top level


See Also

begin_module / 1, create_module / 1, erase_module / 1, current_module / 1, module_interface / 1