Availability:built-in
require(+Predicates)Declare that this file/module requires the specified predicates to be
defined “with their commonly accepted definition” . Predicates
is either a list of predicate indicators or a comma-list of
predicate indicators. First, all built-in predicates are removed from
the set. The remaining predicates are searched using the library index
used for autoloading and mapped to a set of autoload/2
directives. This implies that the targets will be loaded lazily if
autoloading is not completely disabled and loaded using use_module/2
otherwise. See
autoload.
The require/1
directive provides less control over the exact nature and location of
the predicate. As autoload/2,
it prevents a local definition of this predicate. As SWI-Prolog
guarantees that the set of built-in predicates and predicates available
for autoloading is unambiguous (i.e., has no duplicates) the
specification is unambiguous. It provides four advantages over autoload/2:
(1) the user does not have to remember the exact library, (2) the
directive can be supported in other Prolog systems57SICStus
provides it, providing compatibility despite differences in
library and built-in predicate organization, (3) it is robust against
changes to the SWI-Prolog libraries and (4) it is less typing.