diff options
author | Paulo Moura <pmoura@logtalk.org> | 2019-02-03 17:15:39 +0000 |
---|---|---|
committer | Paulo Moura <pmoura@logtalk.org> | 2019-02-03 17:23:31 +0000 |
commit | c0d134c2d90aa03a2ab2e75389353524a46c1bb9 (patch) | |
tree | 7dcbda3771c1bc06cfc4df9a2ff76fb42d9e8e48 /logtalk.html.markdown | |
parent | 96a44abb1d5832c3b7a5bded015fb721998e0a09 (diff) |
Improve section on compiling and loading source files
Diffstat (limited to 'logtalk.html.markdown')
-rw-r--r-- | logtalk.html.markdown | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/logtalk.html.markdown b/logtalk.html.markdown index 5a52bd3c..ce907ee3 100644 --- a/logtalk.html.markdown +++ b/logtalk.html.markdown @@ -40,7 +40,7 @@ An object encapsulates predicate declarations and definitions. Objects can be cr :- end_object. ``` -# Compiling source files +# Compiling and loading source files Assuming that the code above for the `list` object is saved in a `list.lgt` file, it can be compiled and loaded using the `logtalk_load/1` built-in predicate or its abbreviation, `{}/1`, with the file path as argument (the extension can be omitted): @@ -49,6 +49,11 @@ Assuming that the code above for the `list` object is saved in a `list.lgt` file yes ``` +In general, entities may have dependencies on entities defined in other source files (e.g. library entities). To load a file and all its dependencies, the advised solution is to define a +_loader_ file that loads all the necessary files for an application. A loader file is simply a source file, typically named `loader.lgt`, that makes calls to the `logtalk_load/1-2` +built-in predicates, usually from an `initialization/1` directive for portability and +standards compliance. Loader files are provided for all libraries, tools, and examples. + # Sending a message to an object The `::/2` infix operator is used to send a message to an object. As in Prolog, we can backtrack for alternative solutions: |