Up Next

23.1  Using compatibility language dialects

The ECLiPSe compatibility language dialects are the fastest way to get a program running that was originally written for a different system. The dialects are implemented as libraries. The module system makes it possible for different application modules to use different language dialects.

To use a particular language dialect, prefix your program with a module/3 directive that specifies the desired language dialect, for example

    :- module(mymodule, [], iso).

Here, the last argument of the module/3 directive indicates the language (the default being eclipse_language). It is not advisable to use :-lib(iso) or :-ensure_loaded(library(iso)) within an eclipse_language module, because this would lead to import conflicts between the different versions of built-in predicates.

Examples of supported language dialects are

See the Reference Manual for details on the compatibility provided by the language dialects. The language dialects are just modules which provide the necessary code and exports to emulate a particular Prolog dialect. This module is imported instead of the default eclipse_language dialect which provides the ECLiPSe language. The source code of the language dialect module is provided in the ECLiPSe library directory. Using this as a guideline, it should be easy to write similar packages for other systems, as long as their syntax does not deviate too much from the Edinburgh tradition.

For quick experiments with a language dialect, ECLiPSe can be started with a different default_language option (see appendix D), e.g.

    % eclipse -L <dialect>

This will give you a toplevel prompt in the given language dialect. The same effect can be achieved by setting the ECLIPSEDEFAULTLANGUAGE environment variable to the name of the chosen dialect.

23.1.1  ISO Prolog

The ISO Prolog standard [1] is supported in three variants:

The specification of implementation-defined features stipulated by the standard can be found in the reference manual for iso_strict and iso.

23.1.2  Compiler versus interpreter

The following problem can occur despite the use of compatibility packages: If your program was written for an interpreter, e.g., C-Prolog, you have to be aware that ECLiPSe is a compiling system. There is a distinction between static and dynamic predicates. By default, a predicate is static. This means that its clauses have to be be compiled as a whole (they must not be spread over multiple files), its source code is not stored in the system, and it can not be modified (only recompiled as a whole). In contrast, a dynamic predicate may be modified by compiling or asserting new clauses and by retracting clauses. Its source code can be accessed using clause/1,2 or listing/0,1. A predicate is dynamic when it is explicitly declared as such or when it was created using assert/1. Porting programs from an interpreter usually requires the addition of some dynamic declarations. In the worst case, when (almost) all procedures have to be dynamic, the flag all_dynamic can be set instead.

Up Next