TYPICAL / Guided Tour
Bottom 

Module system

TYPICAL of Annotated Prolog includes a module system.
It is possible to use two different kinds of module sections in a file:

The interface section is in the corresponding module file of the module. The name of the corresponding module file is identical with the module name.

The body section can be in any file. Additionally it is possible to separate the body section into several body section parts saved in different files.

Only predicate declarations and type definitions in the interface section are exported by the module. It is supported to export a type definition abstractly.

The module system is able to import indirectly. Selective import commands for predicate declarations or type definitions can be given.

Only clauses in the body section of a module are checked by TYPICAL.

Directives for defining module sections

interface section

:- tap_interface.
:- tap_interface_end.

body section

:- tap_body.
:- tap_body(
module_name).
:- tap_body(
module_name, list_of_files_with_a_body_section_part). % for body section part
:- tap_body_end.
:- tap_body_end(module_name).

Directives for import

:- import(module_name).                 % all exported type definitions and predicate declarations
:- import_type(module_name).            % only exported type definitions
:- import_type(module_name, type_name).

:- import_pred(module_name).            % only exported predicate declarations
:- import_pred(module_name, pred_name).

Top 
PREV: Meta-programming examples
NEXT: Imports from a file

TYPICAL / Guided Tour