The Logtalk system is entirely written in Prolog, without resorting to other programming languages. In spite of that, the fact that the ISO standard [ISO 95] has only recently been approved causes a lot of problems when we try to ensure compatibility with most of the existing Prolog compilers [Moura 99]. If most syntax problems can be easily solved, the same does not happen when we talk about built-in predicates, where we face several difficulties. In the first place, many compilers do not implement the total of the predicates defined in ISO standard, which can be considered quite minimalist in this respect. Sometimes they implement those predicates in a way that does not match the standard or other compilers, thus concurring to the existence of subtle errors quite difficult to detect. To make things worse, it is not possible to replace some of the absent predicates and directives with our own definitions, due to the very nature of those predicates and directives. Consequently, some of the Logtalk system features (e.g., error handling) may not work in some compilers.
The adopted solution consists on developing a universal Logtalk version, linked to a given compiler through the definition of a small set of predicates and operators, assembled in a configuration file. These predicates can be divided in two groups. The first group contains Logtalk specific predicates. The second group tries to implement predicates that, although they are defined in the approved ISO Prolog Standard, are not available in the specific compiler we want to use. This manual session explains how to build a configuration file for a Prolog compiler.
Logtalk is compatible with almost any machine/operating system with a modern Prolog compiler available. Currently, my main development environment is an upgraded Apple PowerMacintosh 7600 running Mac OS 9 and LinuxPPC; most used compilers are the Mac port of GNU Prolog and, under Linux, YAP and SWI Prolog. Being written in Prolog and distributed in source form, the only issue regarding operating system compatibility are the end-of-line codes in the source text files! Most example source file names do not fit in the 8+3 MS-DOS file length limitation, so this may prevent those examples from running under this operating system (or in any other system with similar limitations).
In writing Logtalk I have tried to follow the recently approved Prolog ISO standard whenever possible. Capabilities needed by Logtalk that are not defined in the ISO standard are:
dynamic
, static
, built_in
)
Logtalk needs access to the predicate propertybuilt_in
to properly compile objects and categories that contain Prolog built-in predicates calls. In addition, some Logtalk built-ins need to know the dynamic/static status of predicates to ensure correct application. The ISO standard for Prolog modules defines a predicate_property/2
predicate that is already implemented by most Prolog compilers. Note that if these capabilities are not built-in the user cannot easily define them.
For optimal performance, Logtalk requires that the Prolog compiler supports first-argument indexing for both static and dynamic code (most modern compilers support this feature).
Because most Prolog implementers are slowly moving toward more ISO compliant compilers, it is advisable that you try to use the most recent version of your favorite Prolog compiler.
Configuration files provide the glue code between the Logtalk preprocessor/runtime and a Prolog compiler. Each configuration file contains two sets of predicates: ISO Prolog standard predicates and directives not built-in in the target Prolog compiler and Logtalk-specific predicates.
Logtalk already includes ready to use configuration files for most Prolog compilers. However, you may need to write your own configuration file if one is not available for your Prolog compiler. In most cases, you can borrow code from some of the predefined configuration files. If you send me your configuration file, with a reference to the target Prolog compiler, maybe I can include it in the next release of Logtalk.
Start by making a copy of the file configs/template.config
. Carefully check (or complete if needed) each listed definition. If your Prolog compiler conforms to the ISO standard, this task should only take you a few minutes.
If you are unsure that your Prolog compiler provides all the ISO predicates needed by Logtalk, try to run the system by setting the unknown predicate error handler to report as an error any call to a missing predicate. Better yet, switch to a modern, ISO compliant, Prolog compiler.