# Ann: SWI-Prolog 8.2.0 (stable)

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-8-2-0-stable/2413>\
**Category:** Releases\
**Created:** [May 27, 2020, 1:07pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-2-0-stable/2413 "2020-05-27T13:07:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 27, 2020, 1:07pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-2-0-stable/2413/1 "2020-05-27T13:07:32Z")

</div>

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 ☹ 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:

## Tabling

Thanks to the financial support by [Kyndi](https://kyndi.com/) 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](https://github.com/cmu-sei/pharos#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.

## Arithmetic

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](https://www.swi-prolog.org/pldoc/doc_for?object=current_prolog_flag/2#flag:autoload) 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](https://www.swi-prolog.org/pack/list?p=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/init.pl` |
| `~/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 ...] [script.pl ...] [--] [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!

## SSL

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

## Documentation

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](https://www.swi-prolog.org/ChangeLog?branch=stable&from=8.0.3&to=8.2.0)

---

<div class="post-metadata">

**Author:** ![swi](https://avatars.discourse-cdn.com/v4/letter/s/51bf81/32.png) [@swi](https://swi-prolog.discourse.group/u/swi)\
**Post date:** [May 27, 2020, 7:51pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-2-0-stable/2413/2 "2020-05-27T19:51:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![josderoo](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/josderoo/32/3752_2.png) [@josderoo](https://swi-prolog.discourse.group/u/josderoo)\
**Post date:** [May 27, 2020, 10:54pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-2-0-stable/2413/3 "2020-05-27T22:54:20Z")

</div>

Jan,

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

Kind regards,  
Jos
