Ann: SWI-Prolog 8.3.28

Dear SWI-Prolog user,

SWI-Prolog 8.2.28 is ready for download. Highlights:

  • @dmchurch pushed a giant patch that changes the way the notion of
    the current engine is passed around. This makes the code a lot
    more readable and has some benefits on performance. The benchmarks
    show up to 10% improvement! On real programs the effect is less

  • @dgelessus added a SICStus compatible “FD set” API to clp(fd).

  • Some fixes to well founded semantics incremental updates in

  • Changes to global variables: backtracking over the creation of
    a backtrackable global variable deletes the variable and the
    exception/3 hook is called only once and is not called on
    variables that have been deleted explicitly.

  • absolute_file_name/3 without an access or (directory) file type
    no longer accesses the filesystem and thus reports both files
    and directories. Compatibility with SICStus.

  • @peter.ludemann provided more Google protobuf support.

  • @ericzinda provided the first version of his language server
    package with a client for Python. The name of the package is
    going to change and various further changes have been proposed
    here and will be implemented. Clients for other languages are
    also planned. The idea of this package is to give access that
    is close to using Prolog as a library from any language using
    a fairly simple JSON based protocol.

    Enjoy — Jan

SWI-Prolog Changelog since version 8.3.27

  • PPA: Groovy is no longer supported. Added Hirsute

  • DOC: absolute_file_name/2. Issue#871

  • MODIFIED: absolute_file_name/3 to return directories if the requested
    access is none and no file type is specified as regular or

  • MODIFIED: b_setval/2: backtracking over creating a global variable
    deletes the variable. If the old behavior is desired one can use
    nb_setval(Var, []) before calling b_setval/2.

  • MODIFIED: Global variables no longer use exception/3 for lazy
    evaluation after nb_delete/1 or after exception/3 called by
    nb_current/2 with a given variable name failed to define the variable.

  • ADDED: Integrate language_server package into the infrastructure

  • ADDED: language_server package by Eric Zinda

  • FIXED: Removed remaining literal __PL_ld references

  • ADDED: SICStus-compatible “FD set” API to library(clpfd).

  • ADDED: fd_degree/2 to library(clpfd).

  • ADDED: dict_size/2. Issue#864. David Tonhofer.

  • MODIFIED: LDFUNC refactor, part 2 (manual) This is the second of two
    commits that applies a refactor across the entire SWI-Prolog codebase,
    changing the syntax of passing LD from one function to another in
    internal library code. The bulk of the changes in this refactor were
    automated via Perl script in the previous commit; see that commit
    message for more details on that.

    Previously, functions that wanted to access LD (the local data
    structure) could either use the GLOBAL_LD macro, declare the
    GET_LD/PRED_LD macros early in the function, or declare ARG_LD/ARG1_LD
    somewhere in the function parameter list. Calling these functions
    required either declaring a macro (usually in pl-ldpass.h) that would
    add the LD argument to any call to the function, or adding a
    PASS_LD/PASS_LD1 annotation to each callsite.

    The new style revolves around a new macro called LDFUNC, defined in
    src/pl-builtin.h; see that file for details on its use. PASS_LD and
    its variants are no longer required at callsites; all LDFUNC-augmented
    functions have macro definitions that add the necessary arguments
    to the function call. Additionally, name-mangling is performed on
    function names, so it is no longer required to add __LD to a function
    name to keep it from colliding with externally-visible API functions.

    This commit also adds the API_STUB macro, which ensures that API
    function definitions do not have their names mangled, along with
    including a GET_LD declaration automatically.

    For more information, see the following post:

    Changes to LD-handling in library code

  • MODIFIED: LDFUNC refactor, part 1 (automated) This is the first of
    two commits that applies a refactor across the entire SWI-Prolog
    codebase, changing the syntax of passing LD from one function to
    another in internal library code. More details on the refactor are
    in the following commit, but since this touches so much code and to
    avoid having to manually verify a 20,000+ line diff, the bulk of the
    changes in this commit are automated by a Perl script, saved here
    (for this commit only) as src/ld-refactor.perl, with the output of
    the run saved in src/ld-refactor.out. This way, the script itself
    can be audited for correctness, and only the special cases in the
    following commit need to be checked manually.

  • FIXED: Re-evaluation through a cycle where the argument of tnot/1
    is invalid.

  • FIXED: reloading with :- discontiguous/1 directive in included
    file. Edison Mera.

  • ADDED: predicate_property/2 property discontiguous to reflect the
    effect of the discontiguous/1 directive.

  • FIXED: If tnot/2 is evaluated from an existing table we must make
    sure this table is part of the dependency graph.

  • FIXED: We must reset some worklist properties prior to reevaluation
    for WFS to work properly.

  • FIXED: We must preserve the TN_IDG_UNCONDITIONAL flag during
    re-evaluation to be able to detect that a previously conditional
    answer became unconditional after reevaluation. This also implies we
    no longer need the save/restore related to exception handling.

  • FIXED: we must consider a table modified if an answer turns
    unconditional while it was conditional before.

Package plunit

  • DOC: Replace LaTeX docs for show_coverage/1,2 with the PlDoc generated

  • FIXED: Coverage annotation with long file paths. @peter.ludemann.

Package protobufs

  • ENHANCED: support for protobuf map<…>

  • DOCUMENTATION: oneof, map

  • ENHANCED: handle “oneof” fields

  • ENHANCED: meta-data loading (generated by protoc --swipl_out=…)

  • FIXED: protoc plugin when .proto file has no package name (possibly
    a bug in protoc)

  • ENHANCED: handle default values when parsing a wire stream.


Brilliant work, Jan and everyone else involved. It’s really impressive how fleshed-out and powerful SWI-Prolog has become. Looking forward to using all the new features.

when 8.3.x is available as a stable version

The plan is “soon”. I expect beginning of September.

1 Like