While qpc
is compiling Prolog source into QOF, certain
built-in predicates are treated in a special way. Their behavior when
used as embedded commands under qpc
is different from
their normal behavior. For example, (A) causes the file foo.pl
to be
compiled into .qof
format, not, as you would expect from its normal
meaning, into (qpc
's) memory.
:- compile(foo). (A)
Similarly, if you define (B) in an initialization file, then the command (C) will cause foo to be compiled into QOF format after whatever goals you specified have been called.
my_compile(File) :- (B) ...{some goals}..., compile(File).
:- my_compile(foo). (C)
The load_files/2
when
option can be used to force a file to
be loaded into memory at compile-time if so desired.
Note that the change of meaning of compile/1
etc does not apply
during the loading of an initialization file, only while
compilation to .qof
format is taking place. Thus, if you put
:- my_compile(foo).
in your initialization file (after the definition of my_compile/1
), then
this would mean compile foo.pl
into memory.
The predicates following this behavior are:
compile/1
consult/1
load_files/[1,2]
ensure_loaded/1
load_foreign_files/2
load_foreign_executable/1
no_style_check/1
op/3
reconsult/1
style_check/1
use_module/[1,2,3]
./2
Note that an embedded command of the form
:- compile(user).
will cause an error message from qpc
. The same is true
for specifying user
in embedded calls to consult/1
and similar
commands, as well as in the command line of qpc
. The
reason for this restriction is to avoid possible confusion; under the
Development System, giving user
as the argument to one of these
predicates allows you to enter clauses directly from the terminal.
Clauses for the predicates foreign/[2,3]
and foreign_file/2
are treated
specially by qpc
. They are always assumed to be compile-time
predicates, to be used by a subsequent embedded
load_foreign_executable/1
or load_foreign_files/2
goal. Therefore they are consulted into qpc
's internal database
rather than being compiled into QOF.