Up Next

8.1  Basics

8.1.1  Purpose of Modules

The purpose of the module system is to provide a way to package a piece of code in such a way that

In particular, this helps with

8.1.2  What is under Visibility Control?

The ECLiPSe module system governs the visibility of the following entities:

Predicate names
Predicates can always be used in the module where they are defined and optionally in other modules when they are made available.
Structure names
Structure declarations can be valid only locally within a module, or shared between several modules.
Syntax settings
These include operator declarations (see op/3), syntax options and character classes. This means in particular that different modules can use different language dialects (e.g., ECLiPSe vs. ISO-Prolog).
Container names
These include the names of record keys, non-logical variables and references. They are always local to the module where they are declared.
Initialization and finalization goals
Modules can have initialization and finalization goals attached, see section 8.4.3.

Note that every definition (predicate, structure etc.) is in some module, there is no space outside the modules. When you don’t explicitly specify a module, you inherit the module from the context in which you do an operation. When you are using an interactive ECLiPSe toplevel, a prompt will tell you in which module your input is read and interpreted.

8.1.3  What Modules are There?

The module system is flat, i.e., no module is part of another module, and module names must be unique. There are


Up Next