logtalk_load/1¶
Description¶
logtalk_load(File)
logtalk_load(Files)
Compiles to disk and then loads to memory a source file or a list
of source files using the default compiler flag values. The Logtalk source
file name extension (by default, .lgt
) can be omitted. Source file
paths can be absolute, relative to the current directory, or use
library notation. This predicate can also be used to compile Prolog
source files as Logtalk source code. When no recognized Logtalk or Prolog
extension is specified, the compiler tries first to append a Logtalk source
file extension and then a Prolog source file extension. If that fails, the
compiler tries to use the file name as-is.
When this predicate is called from the top-level, relative source file paths are resolved using the current working directory. When the calls are made from a source file, relative source file paths are resolved using the source file directory.
Note that only the errors related to problems in the predicate argument are listed below. This predicate fails when errors are found during compilation of a source file.
Depending on the backend Prolog compiler, the shortcuts {File}
or {File1, File2, ...}
may be used in alternative. Check the adapter
files for the availability of these shortcuts as they are not part of
the language (and thus should only be used at the top-level
interpreter).
Modes and number of proofs¶
logtalk_load(@source_file_name) - zero_or_one
logtalk_load(@list(source_file_name)) - zero_or_one
Errors¶
instantiation_error
instantiation_error
type_error(source_file_name, File)
existence_error(library, Library)
existence_error(file, File)
Examples¶
% compile and load the "set" source file in the
% current directory:
| ?- logtalk_load(set).
% compile and load the "tree" source file in the
% "types" library directory:
| ?- logtalk_load(types(tree)).
% compile and load the "listp" and "list" source
% files in the current directory:
| ?- logtalk_load([listp, list]).