Ann: SWI-Prolog 8.5.19

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

    • sweeprolog.el: - sweeprolog-read-predicate-history: new
      variable. - sweeprolog-read-predicate: use it, and default to
      the predicate at point. - sweeprolog–colour-term-to-faces:
      quote symbol - sweeprolog-describe-predicate: new command. -
      sweeprolog-help-prefix-map: bind it. * README.org: Prolog Help:
      mention it.
  • 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: 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: document it.

  • DOC: mention new sweep Prolog flag in README.org and 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 “=…”.

    • sweeprolog-tests.el: add unit test.
  • ADDED: Flymake integration in sweeprolog-mode *
    sweeprolog.el: - sweeprolog-enable-flymake: new user option.

    • sweeprolog–diagnostics: new buffer-local variable. -
      sweeprolog–diagnostics-report-fn, sweeprolog–diagnostics-changes-beg,
      sweeprolog–diagnostics-changes-end: new buffer-local
      variables. - sweeprolog-defface: add docstrings for generated
      functions. - sweeprolog–colourise: accumulate diagnostics when
      sweeprolog-enable-flymake is non-nil. - sweeprolog-colourise-buffer,
      sweeprolog-colourise-some-terms: report diagnostics when
      sweeprolog-enable-flymake is non-nil. - sweeprolog-show-diagnostics:
      new command in sweeprolog-mode buffers. - sweeprolog-mode-map:
      bind it. - sweeprolog-diagnostic-function: new function. -
      sweeprolog-mode: use it when sweeprolog-enable-flymake is non-nil. *
      README.org: Examining diagnostics: new section. * NEWS.org: announce
      flymake integration.
  • 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: 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: document it. - 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

2 Likes

It is my understanding that most programmers would expect a version number of Major.Minor.Patch to be semantic versioning. 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 and the corresponding numbering the only things I know for certain are

  • The numbers do increase and are sequential :slightly_smiling_face:
  • 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

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. :slightly_smiling_face:


EDIT

After reading reply by Jan W.

Example of DIRTY version. (ref)

SWI-Prolog version 8.5.7-26-g4a0a2091e-DIRTY

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

[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.

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 :frowning: 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 :frowning: 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 :slight_smile:

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

  • 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 :frowning:
  • transactions
  • The $/0, $/1, det/1 and => operators for safe “functional” code.
  • CMake based builds
  • Yield from foreign code.
  • WASM port
1 Like

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?

Yes, that rings a bell. :bell:


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

Perhaps the SWI-Prolog Versions 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. :slightly_smiling_face:

Much of what you noted in the reply is very useful and nice to see elaborated (will repost parts as a separate nice to know topic). :slightly_smiling_face:

And then suddenly the crash happened :slight_smile: 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.

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?

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

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 =>.