# Ann: SWI-Prolog 8.5.19

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861>\
**Category:** Releases\
**Created:** [October 17, 2022, 7:43pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861 "2022-10-17T19:43:24Z")\
**Posts on this page:** 11\
**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:** [October 17, 2022, 7:43pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/1 "2022-10-17T19:43:25Z")

</div>

Dear SWI-Prolog user,

SWI-Prolog 8.5.19 is ready for download. Highlights:

- Lots of new features to the new Emacs sweep mode by @oskardrums.  
Sweep improvements also concern platform issues in getting the  
mode running. Please report your findings.
- More bigint to float improments by @ridgeworks.
- Various enhancements to the WASM port. See details below.
- Updates to embedding: enhance `<home>/cmake/swipl.cmake` and  
provide access from scripts to the Prolog home simply using `swipl --home`.

According to the plan, the next release should bump the stable version,  
releasing the current state as 8.6.0 (maybe 9.0.0, opinions?). From  
there, 8.6.x/9.0.x should stabilize quickly.

```
Enjoy --- Jan

```

# SWI-Prolog Changelog since version 8.5.18

- PORT: Include Emacs interface in MacOS bundle

- MODIFIED: Removed an ancient mechanism for finding the Prolog home  
directory from a magic string in the binary. Changed plain `-home`  
to print the home directory and exit (used to ignore and run).

- WASM: Maintain a stack of open queries such that we can detect when  
we act on a query that is not the innermost. Currently only prints  
to the console.

- WASM: By default load scripts and files into the `user` module.

- PORT: Emscripten does not set `CMAKE_EXECUTABLE_FORMAT`. As all  
this is meaningless with statically linked WASM version we do not  
set the `executable_format` and `libswipl` flags

- ADDED: prolog\_walk\_code/3 option `on_edge` which is similar to  
`on_trace`, but provide easier to understand source locations.

- FIXED: Add ‘$seek\_list’/4 to library(sandbox). Breaks nth1/3 and  
nth0/3.

- FIXED: Make Prolog backtrace work in ISO mode.

- FIXED: Big integer to float (mpz\_to\_double()) to\_nearest, half to  
even rounding and also a couple of minor cosmetic changes.

- ADDED: Extend check\_installation/0 with sweep.

- ADDED: new flags executable\_format and libswipl New read-only Prolog  
flags determined at swipl compile time. These flags are intended  
to allow package sweep to determine if libswipl needs to be loaded  
ahead of sweep-module (when executable\_format=elf), and if so to  
locate libswipl.

- WASM: Shell: make edit/1 work to show source of the libraries.

- WASM: Shell: allow collapsing the answers to a query.

- WASM: Enhanced `:=/2`: get global variables using eval() such that  
it also works on Node and raise a Prolog exception in case something  
goes wrong.

- WASM: Shell: add splitter to allow changing the distribution of the  
output and editor.

- WASM: make shell demo console output more structured.

- WASM: Shell: add examples from the server

- WASM: Added fetch/3 as public function of library(wasm).

- WASM: Cleanup js\_script/2 to simply call `_ := eval(String).`  
This also makes this work in Node.

- WASM: Make Prolog.call() and Prolog.forEach() call by default in the  
`user` module rather than system.

- FIXED: help/1: avoid problems with modules that are also section  
labels. @swi.

- WASM: Use CodeMirror in shell.html (from CDN such that we do not need  
to grow our distribution).

- WASM: Make local compilation not use sig\_atomic/1 as that breaks  
yielding and we have no signals anyway.

- ADDED: Support conditional compilation in boot/init.pl

- DOC: updated manual section about GNU Emacs interfaces

- ADDED: flag libswipl\_dir holding the installation dir of libswipl

- WASM: Extend data transformation in `:=/2` and improve documentation.

- FIXED: WASM: await if the promise returns a compound term or list.

- WASM: `:=/2` should pass a list as data instead as a call on  
`'[|]'(h,t)`.

- WASM: Documentation updates and LaTeX fixes to the docs.

## Package cpp

- TEST: Avoid dependency on gethostname introduced by the tests.

## Package sweep

- ENHANCED: prompt for sweeprolog-describe-predicate Following feedback  
from Jan Wielemaker

- FIXED: additional compatibility issue with buttons

- FIXED: sweeprolog-describe-predicate compatibility with Emacs 28

- ADDED: new command for showing help for Prolog predicates \*  
sweep.pl: sweep\_predicate\_html\_documentation/2: new predicate

- ADDED: new command for showing help for Prolog modules \*  
sweep.pl: sweep\_module\_html\_documentation/2: new predicate. \*  
sweeprolog.el: - sweeprolog-read-module-history: new variable. -  
sweeprolog-read-module-name: use it. - sweeprolog–describe-module:  
new function. - sweeprolog-describe-module: new command. -  
sweeprolog-help-prefix-map: new keymap. - sweeprolog-prefix-map:  
bind it keymap to `h’. \* [README.org](http://README.org): Prolog Help: new section.

- ENHANCED: update xref data for buffer after exporting predicate

- FIXED: possible loop finding start of clause at start of buffer

- ADDED: new command for exporting Prolog predicates \* sweep.pl:  
sweep\_local\_predicate\_export\_comment/2: new predicate. \*  
sweeprolog.el: - sweeprolog-read-exportable-predicate-prompt:  
new user option. - sweeprolog–exportable-predicates: new buffer  
local variable. - sweeprolog–colour-term-to-faces: accumulate  
exportable predicates. - sweeprolog-colourise-buffer: reset  
sweeprolog–exportable-predicates. - sweeprolog-export-predicate:  
new command. - sweeprolog-mode-map: bind it. - sweeprolog-menu:  
bind it. - [README.org](http://README.org): document it.

- DOC: mention new sweep Prolog flag in [README.org](http://README.org) and [NEWS.org](http://NEWS.org)

- FIXED: sweep\_identifier\_at\_point/2: possible infinite failure loop

- FIXED: disregard stderr when invoking write\_sweep\_module\_location

- ENHANCED: create Prolog flag sweep=true when running under sweep

- DOC: index some keystrokes in the manual

- PORT: Try to find emacs-module.h in the $MINGW\_ROOT to build it along  
with the Windows versions.

- DOC: Update section “Things to do”

- ENHANCED: use next-error-select-buffer when switching to  
a buffer \* sweeprolog.el: sweeprolog-mode: add hook to  
window-selection-change-functions.

- FIXED: sweeprolog-end-of-top-term would get confused by “=..” \*  
sweeprolog.el: sweeprolog-end-of-top-term: don’t stop after “=..”.

- ADDED: Flymake integration in sweeprolog-mode \*  
sweeprolog.el: - sweeprolog-enable-flymake: new user option.

- DOC: add descriptions to all manual sections

- FIXED: quote file paths passed to shell-command-to-string \*  
sweeprolog.el: sweeprolog–ensure-module: quote paths and use packaged  
sweep.pl \* [README.org](http://README.org): fix typo

- ADDED: new command and user option for updating whitespace \*  
sweeprolog.el: - sweeprolog-align-spaces: new command, updates  
whitespace around point according to SWI-Prolog conventions. -  
sweeprolog-enable-cycle-spacing: new user option, when non-nil  
sweeprolog-align-spaces is added to cycle-spacing-actions. -  
sweeprolog-mode: use it. - [README.org](http://README.org): document it. - [NEWS.org](http://NEWS.org):  
announce it.

- FIXED: detecting end of clause with inline comments ending with “.”

- DOC: added short documentation for sweep as a SWI-Prolog package

- PORT: don’t use defvar-keymap, introduced only in Emacs 29

- TEST: add unit test for nested Elisp-\>Prolog-\>Elisp call chains

- ENHANCED: allow for Elisp-\>Prolog-\>Elisp-\>… call chains

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 17, 2022, 9:16pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/2 "2022-10-17T21:16:20Z")

</div>

> [@jan](#):
>
> (maybe 9.0.0, opinions?)

It is my understanding that most programmers would expect a version number of _ **Major.Minor.Patch** _ to be [semantic versioning](https://semver.org/). Since a change in a Major number indicates a breaking change then I would expect something to have broken.

Over the last few years of seeing the SWI-Prolog [releases](https://swi-prolog.discourse.group/c/releases/5) and the corresponding numbering the only things I know for certain are

- The numbers do increase and are sequential 🙂
- When the second number (Minor) is even it is a stable release
- That version numbers created from a Git Pull have the commit hash appended.
- There is another variation of the version that I see so rarely I can’t remember off the top of my head.
- The stable versions at times do increment the Patch value if a backward patch is made.
- There is a documentation page on version numbers: [SWI-Prolog Versions](https://www.swi-prolog.org/versions.txt)

Personally I like seeing software with low Major numbers and large Minor numbers even with Minor numbers in the hundreds if the really are following semantic versioning. 🙂

* * *

**EDIT**

After reading [reply](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/4) by Jan W.

Example of DIRTY version. ([ref](https://swi-prolog.discourse.group/t/running-eye-on-swipl-wasm/5030))

`SWI-Prolog version 8.5.7-26-g4a0a2091e-DIRTY`

---

<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:** [October 18, 2022, 1:52am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/3 "2022-10-18T01:52:47Z")

</div>

Commit cd1e78c2b28e292bd0c68b586a2cf820e844107e `MODIFIED: Removed an ancient mechanism for finding the Prolog home directory` breaks the build for me:

```prolog
[6/22] Generating ../home/boot.prc
FAILED: home/boot.prc /tmp/swipl-devel/build.release/home/boot.prc 
cd /tmp/swipl-devel/build.release/src && /usr/bin/cmake -E remove -f /tmp/swipl-devel/build.release/home/boot.prc && /tmp/swipl-devel/build.release/src/swipl -q -O -o /tmp/swipl-devel/build.release/home/boot.prc -b /tmp/swipl-devel/build.release/home/boot/init.pl
[7/22] Linking CXX executable packages/swipl-win/swipl-win
ninja: build stopped: subcommand failed.

```

EDIT:

`src/swipl` segfaults, it seems you need to do `ninja clean && ninja` to reproduce.

---

<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:** [October 18, 2022, 7:57am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/4 "2022-10-18T07:57:20Z")

</div>

> [@EricGT](#):
>
> the only things I know for certain are

I think these are all correct :). The “rarely” one is probably the mark as `DIRTY`, which appears when you build inside the git tree and the tree has not-yet-comitted changes. I.e., the current state cannot be described using a commit hash.

I think SWI-Prolog is not subject to _semantic versioning_. That schema is fine for libraries with a fairly small and well defined API and functionality. For a complex system as SWI-Prolog that doesn’t really work. Patch levels in the development series are merely approximately 2 week snapshots of the development. Actual _patches_ as in bug fixes are in there, but usually there is also new functionality (which would ask for a minor bump) or even compatibility breaking modifications (which would ask for a major bump). So, the whole model breaks ☹ In the stable series, patch levels should only fix stuff and possibly add stuff that is very unlikely to break anything and is valuable for allowing code to run on the stable and devel series or simply adds something considered valuable enough to take the small risk that it breaks something. Note that (not even) theoretically any change can break things, even bug fixes.

So, we do not do semantic versioning because it does not work for us ☹ Our patch level increments, but is otherwise meaningless. Our minor increments when we do a devel → stable merge (on both series with 2). The major is meaningless. Pretty much as e.g., Linux. Also here Linus Thorvalds decides to bump the major at rather random moments if I understand that correctly. A major bump sends a message “the system is now a lot better” and resets the minor. Or, maybe, “even if you are really conservative, it gets time to upgrade”. The only real major was version 7 🙂

So far, the 8.x series brought this. It may be time to upgrade if you are still at 8.0 🙂

- multi-argument and _deep_ indexing
- Tabling with answer subsumption, well founded semantics, restraints, incremental tabling, shared tabling and monotonic tabling.
- Rational numbers as prime citizens. IEEE754 float support, more use of rationals, “mostly” correct float rounding ☹
- transactions
- The `$/0`, `$/1`, det/1 and =\> operators for safe “functional” code.
- CMake based builds
- Yield from foreign code.
- WASM port

---

<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:** [October 18, 2022, 8:04am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/5 "2022-10-18T08:04:16Z")

</div>

> [@swi](#):
>
> Commit cd1e78c2b28e292bd0c68b586a2cf820e844107e `MODIFIED: Removed an ancient mechanism for finding the Prolog home directory` breaks the build for me:

Hmm. Tried everything. Clean build, the ASAN based build, incremental builds, tests, all works fine. Also the clean builds for the release worked fine. Something dirty or some environment variable causing a mixup? In the latter case please report so we can extend the set of variables that we check as we know they can lead to trouble.

Anyone else?

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 18, 2022, 8:10am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/6 "2022-10-18T08:10:35Z")

</div>

> [@jan](#):
>
> The “rarely” one is probably the mark as `DIRTY`, which appears when you build inside the git tree and the tree has not-yet-comitted changes. I.e., the current state cannot be described using a commit hash.

Yes, that rings a bell. 🔔

* * *

I have no problem if SWI-Prolog does not use semantic versioning.

Perhaps the [SWI-Prolog Versions](https://www.swi-prolog.org/versions.txt) page should note that while the SWI-Prolog version pattern is the same or similar to semantic versioning it is not actually semantic versioning, then that would end any possible connection and there would be an authoritative reference for future questions on such. 🙂

Much of what you noted in the [reply](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/4) is very useful and nice to see elaborated (will [repost](https://swi-prolog.discourse.group/t/swi-prolog-versioning/5866) parts as a separate nice to know topic). 🙂

---

<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:** [October 18, 2022, 8:55am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/7 "2022-10-18T08:55:32Z")

</div>

> [@jan](#):
>
> Hmm. Tried everything

And then suddenly the crash happened 🙂 Fixed. Probably needs re-releasing as that makes 8.5.19 pretty useless. First resolve some other minor stuff …

---

<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:** [October 18, 2022, 10:24am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/8 "2022-10-18T10:24:31Z")

</div>

> [@jan](#):
>
> And then suddenly the crash happened 🙂 Fixed. Probably needs re-releasing as that makes 8.5.19 pretty useless. First resolve some other minor stuff …

Glad you were able to find and fix it. I wonder what makes the build unrepeatable, `ninja clean && ninja` should have shown the problem. There must be some bug in cmake.

---

<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:** [October 18, 2022, 11:26am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/9 "2022-10-18T11:26:03Z")

</div>

I am not sure. Reading the code, it was setup to crash if either `SWI_HOME_DIR` or `SWIPL` was in the environment (regardless of the value being correct or incorrect). `SWIPL` was the old variable for overruling the home directory. This is now for so long replaced by `SWI_HOME_DIR` that it might be better to remove this? Could it be that ninja sets `SWIPL` under some conditions?

---

<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:** [October 18, 2022, 9:54pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/10 "2022-10-18T21:54:45Z")

</div>

Strange. I grepped through `build.ninja` no reference to those environment variables.

---

<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:** [October 18, 2022, 9:57pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-19/5861/11 "2022-10-18T21:57:08Z")

</div>

> [@jan](#):
>
> (maybe 9.0.0, opinions?)

I think it might be good to switch to 9.0.0, mostly because of the language syntax change with the new single side unification operator =\>.
