Ann: SWI-Prolog 8.2.0 (stable)

Dear SWI-Prolog user,

I’m happy to announce SWI-Prolog 8.2.0, the latest stable release. Ideally, this should be called 8.2.0-alpha, but past experience shows that not all packaging systems can deal with tags and then consider a final 8.2.0 older than 8.2.0-beta :frowning: Still, this should be considered a prerelease, intended for users of the stable releases to verify this version allows you to upgrade. In principle subsequent patches shall not break compatibility. We might make minor exceptions for 8.2.1, for example if some incompatibility between 8.0.3 and 8.2.0 breaks applications but we can easily avoid that or reduce the impact.

A lot of work has been done since. Lots of people have helped making this release possible. Thanks! Here are some highlights:


Thanks to the financial support by Kyndi and Benjamin Grosof initiating collaborative work with Theresa Swift and David S. Warren in migrating the most important parts of XSB tabling into SWI-Prolog the highlight of this version is much faster, more robust and scalable tabling that provides Well Founded Semantics,
restraints (bounded rationality), incremental tabling and thread-shared tables. This opens whole new application application areas such as the OOAnalyzer, a tool “for the analysis and recovery of object oriented constructs” which now runs both on XSB and SWI-Prolog. SWI-Prolog tooling allowed both the OOAnalyzer team (notably Edward Schwartz and Cory Cohen) and the tabling team to better understand the bottlenecks in the application as well as handling incremental tabling in both SWI-Prolog and XSB.

XSB Compatibility

This project has brought a large part of the XSB test suite to SWI-Prolog. To run this suite as much as possible unmodified the portability framework developed long ago with Vitor Santos Costa (YAP) was instantiated for XSB. The fundamentally different module system of XSB makes 100% emulation hard, but programs that use only basic functionality from the module system should work fine.


Rick Workman initiated supporting rational numbers as atomic types and IEEE 754 float arithmetic. This work was coordinated with Joachim Schimpf from ECLiPSe, improving the portability of arithmetic between ECLiPSe and SWI-Prolog. After I added the core rational number representation, Rick has taken care of writing a test suite and
implement/fix details of many of the rational and IEEE 754 float functions.

C interface compatibility

Unfortunately these changes demanded changes to the C interface that broke binary compatibility. Sources are mostly compatible. As full compatibility was broken anyway, we took the opportunity to change the default type for arity to size_t (from int). Users should either update arity declarations or use the following before #include SWI-Prolog.h (updating is preferred):

#define PL_ARITY_AS_SIZE 0

Together with Lev Lamberov and Jonas Smedegaard we came to an ABI versioning system that can be used to verify whether differend Prolog systems are compatible in handling foreign code and saved states.

Development and Deployment

SWI-Prolog 8.2.0 resolves an old dispute between lovers and haters of auto loading. The system now has a directive autoload/1,2 which as semantically equivalent to use_module/1,2 except that the module is loaded lazily. The autoload flag can be used to control autoloading. The various flag settings should satisfy the preferences of each group.

More controlled system dependency handling resulted both in faster startup for small programs and more reliable generation of stand-alone executables.

All consoles (swipl-win.exe and Carlo Capelli’s Qt-based swi-win) now support ANSI color sequences, providing consistent color output using ansi_format/3.

PceEmacs learned a couple of new tricks:

  • C-c C-o: Open Document translates to adding a default module header. If the file already is a module it reports the name of the module.
  • C-c C-e: Export adds the current predicate to the module export list, including mode comment copied from the PlDoc comment.
  • C-c C-d: Dependencies adds missing dependencies to the file using use_module/1,2 or autoload/1,2 directives.

Allow multiple toplevels to co-exists. This is used by the libssh pack to provide a fully functioning toplevel through SSH. This extension can be used to securily login to a continuous running server for examining its status and/or apply hot fixes.

XDG Standard

After discussion on the forum it was decided to adhere the XDG (X Desktop Group) standard for dealing with user configuration and application data files. This is implemented by means of file_search_path/2. Concretely, this renames the following

Old New
~/.swiplrc ~/.config/swi-prolog/
~/lib/prolog ~/.config/swi-prolog/lib
~/lib/swipl/pack ~/.local/swi-prolog/pack

The above are the common defaults. SWI-Prolog respects the XDG environment variables to overrule these.

On Windows, ~/.config uses the win_folder/2 directory appdata and ~/.local the win_folder/2 directory local_appdata.

Command line arguments

Command line argument processing has changed slightly. The most notable change is that unknown flags before the script file result in an error. The general pattern is now:

swipl [prolog-flag ...] [ ...] [--] [application-flag ...]

Stability, portability, etc.

Notable Keri Harris has fixed a large number of stability issues, in particular in the atom garbage collector. I’m always impressed how good he is finding concurrency issues from very few data points! Lev Lamberov has done a lot of work on the Debian control files and testing portability to the many architectures supported by Debian. This resulted in switching to the new __atomic* builtin functions of GCC.

Röbke Geenen has contributed many patches to make the system compile using MSVC on Windows.

Searching for the memory usage of previously mentioned OOAnalyzer as well as SWISH and the SWI-Prolog website the reflexive capabilities to analyze resource usage has been extended a lot (many *_property predicates now provide a size property) and the system now prefers Google’s tcmalloc alternative to the system allocator. Tcmalloc reduces the memory footprint for certain (multi-threaded) workloads a lot (e.g.,
the SWI-Prolog website backends now stabalize around 600Mb instead of growing to about 4Gb). This work also discovered a couple of (minor) leaks.

And, of course, there are many small (but often important) fixes throughout the system based on bug report as well as pull requests. Thanks!


Matt Lilley implemented a lot of enhancements to the SSL interface, including support for XML signatures and SAML authentication.


Many people have contributed to enhance the documentation, both by pointing out omissions and providing pull requests.

Enjoy --- Jan

The usual change list exceeds the maximum post length. It is available from the SWI-Prolog download page changelog


Congratulations! This is quite a leap from 8.0; appreciate all your work and all the contributors!

1 Like


One day I hope to visit you and shake hands to really express my thanks for swipl!

Kind regards,