diff options
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: |