Author(s): Daniel Cabeza.
Version: 1.10#7 (2006/4/26, 19:22:13 CEST)
Version of last change: 1.9#29 (2002/11/20, 14:4:17 CET)
This chapter documents the basic
builtin directives in Ciao, additional to the documented in other chapters. These
directives are natively interpreted by the Ciao compiler (
ciaoc).
Unlike in other Prolog systems, directives in Ciao are not goals to be executed by the compiler or top level. Instead, they are read and acted upon by these programs. The advantage of this is that the effect of the directives is consistent for executables, code loaded in the top level, code analyzed by the preprocessor, etc.
As a result, by default only the builtin directives or declarations defined in this manual can be used in user programs. However, it is possible to define new declarations
using the
new_declaration/1 and
new_declaration/2 directives (or using packages including them). Also, packages may define new directives via code translations.
builtin_directives)builtin_directives)
Usage: :- multifile Predicates.
* ISO *
Predicates may have clauses in more than one file. Each file that contains clauses for a
multifile predicate must contain a directive multifile for the predicate. The directive should precede all clauses of the affected predicates. This directive is defined as a prefix operator in the compiler.
Predicates is a sequence or list of prednames.
(basic_props:sequence_or_list/2)
Usage: :- discontiguous Predicates.
* ISO *
Predicates may be defined in this file by clauses which are not in consecutive order. Otherwise, a warning is signaled by the compiler when clauses of a predicate are not consecutive (this behavior is controllable by the
prolog flag discontiguous_warnings). The directive should precede all clauses of the affected predicates. This directive is defined as a prefix operator in the compiler.
Predicates is a sequence or list of prednames.
(basic_props:sequence_or_list/2)
Usage: :- impl_defined(Predicates).
Predicates is implicitly defined in the current prolog source, either because it is a builtin predicate or because it is defined in a C file. Otherwise, a warning is signaled by the compiler when an exported predicate is not defined in the module or imported from other module.
Predicates is a sequence or list of prednames.
(basic_props:sequence_or_list/2)
Usage: :- redefining(Predicate).
Predicate, also imported from other module, or imports it from more than one module. This prevents the compiler giving warnings about redefinitions of that predicate. Predicate can be partially (or totally) uninstantiated, to allow disabling those warnings for several (or all) predicates at once.
Predicate is compatible with predname
(basic_props:compat/2)
Usage: :- initialization(Goal).
* ISO *
Goal will be executed at the start of the execution of any program containing the current code. The initialization of a module/file never runs before the initializations of the modules from which the module/file imports (excluding circular dependences).
Goal is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Usage: :- on_abort(Goal).
Goal will be executed after an abort of the execution of any program containing the current code.
Goal is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Go to the first, previous, next, last section, table of contents.