Ann: SWI-Prolog 9.1.21

Dear SWI-Prolog user,

SWI-Prolog 9.1.21 is ready for download. Most of the changes are
related to packaging and portability. Highlights:

  • The structure of the installed library has changed. Bundled
    extensions such as clib, http, etc. place their Prolog
    files in library/ext/<package>/*.pl rather than all
    together in the main library. That simplifies finding the
    origin of code and, most importantly, it avoids modifying
    the INDEX.pl files when adding/removing extensions. This
    notably simplifies package management system that chop
    SWI-Prolog into multiple sub packages.

    For the user it should not have many noticible differences.
    However, library(clpq), library(clpr) and library(inclpr)
    are now only accessible by this name and no longer
    as library(clp/clpq), etc.

  • apps for qlf and mqi have been added that simplify
    managing .qlf files from the commandline as well as
    the MQI server. Eventually, more should be added. Candidates
    are e.g., protobufs (the protoc compiler support) and
    PlDoc, for example for generating LaTeX and HTML documentation
    for files.

  • library(main) option help has been extended to allow for
    (PlDoc) markdown in the command description. Still a bit
    slow when used as it lazily loads PlDoc, HTML and HTML to
    text facilities.

  • Janus (the Python) interface got some minor updates. Within
    the PIP team we got agreement on the exception term resulting
    from Python errors. Managing the Python search path has changed
    in two ways: py_add_lib_dir/1 adds a directory at the end
    (was start). When using Prolog with Janus interactively, the
    working directory is added to the Python search path, just
    like Python itself does. Also compatible with the XSB
    Janus.

    The interface is now on janus-swi · PyPI

    Enjoy — Jan

For incremental updates using git, after updating the source run from the build directory

  rm -rf home
  cmake .
  ninja (or make)

SWI-Prolog Changelog since version 9.1.20

  • FIXED: Avoid dependency from library(edit) on library(pce).

  • FIXED: Loading library(readutil) without foreign support Was broken
    since the changes to support static extensions.

  • CLEANUP: list_debug_topics/1 to use a single print_message/2 call.
    Also fixes hooking into debugging/0

  • DOC: Document tty_get_capability/3 exceptions.

  • MODIFIED: prolog:translate_bindings/5 to name the variables.
    Supports named variables in SWISH.

  • INSTALL: #1209 Fixed missing manindex.db during intallation.

  • DOC: Get profiler/2 and related docs from PlDoc rather than LaTeX

  • ENHANCED: When emitting a document, consider text already on the
    current line.

  • ADDED: opt_usage/1: allow for multiple opt_help(help(usage), Usage)
    This allows to present multiple usage lines.

  • ADDED: app qlf This app simplifies commandline driven management
    of QLF files. Use swipl qlf -h for help. The command line syntax
    is still unstable.

  • FIXED: Recompile or ignore incompatible QLF files An incompatible
    VM signature caused loading of a QLF file to result in a warning,
    loading nothing. It now prints a message and recompiles the file.

  • ADDED: check_installation/0 to verify there are no ambiguities in
    the autoload index.

  • ENHANCED: library(portray_text): allow 10% unicode characters

  • MODIFIED: Install each extension in library/ext/dir This allows
    adding and removing extensions without rebuilding the library index
    and clarifies the source of files. This was introduced to simplify
    adding and deleting optional components in e.g., the Windows installer
    or package managers that split SWI-Prolog into multiple packages such
    as used by Debian and planned for Conda.

  • FIXED: Toplevel calls repl_loop_hook/2 with a variable.

  • FIXED: Choice point left by loading the personal init file.

  • FIXED: format_types/2: error on backracking This predicate left a
    choice point and on backtracking produced an error when analyzing
    format strings that contain a *.

  • ADDED: Experimental prolog:repl_loop_hook/2 hook This allows acting
    on entering/leaving interactive mode.

Package chr

  • FIXED: Exported current_chr_constraint/1 from library(chr).
    This predicate replaces the deprecated find_chr_constraint/1, but
    was not exported.

Package clib

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

  • FIXED: uri_edit/3 to consider the initial path '' to be the same as
    /.

  • FIXED: directory_file_path/3 when Dir = ''

Package jpl

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

Package ltx2htm

  • MODIFIED: As all extensions are now installed in a subdirectory we
    no longer need an extra layer.

Package mqi

  • MODIFIED: Install MQI as a SWI-Prolog app This simplifies the command
    line interface and avoids the need for autoloading. New interface is

    swipl mqi [option ...]
    
  • TEST: Don’t use Unix domain sockets if the path is so long that it
    will fail

Package pengines

  • CLEANUP: use uri_edit/3 to compute the final server path

Package pldoc

  • FIXED: Avoid dependency on library(pce) Allows running the
    documentation tools without library(pce)

  • ADDED: print_markdown/2 to emit a string as markdown.

  • CLEANUP: File system interaction to use more libraries.

  • DOC: Document doc_save/1 include_reexported(Bool) option.

Package plunit

  • FIXED: Avoid tty_get_capability/3 exception

Package protobufs

  • BUILD: replace CMake deprecated exec_program() with
    execute_process()

Package semweb

  • ADDED: sparql_query/3: pass SSL options to the SSL context.

Package swipy

  • DOC: Document Prolog exceptions generated by Janus.

  • CLEANUP: Improved consistency of reported type/domain errors.

  • MODIFIED: Moved Python backtrace into second argument of exception.
    Python exceptions are now mapped to

    error(python_error(Type, Data), context(_, python_stack(Stack)))
    

    This change also actually prints the Python backtrace.

  • FIXED: Add current directory to Python sys.path as `‘’`` This is
    compatible to normal interactive Python sessions.

  • ADDED: Version information Added property version_num and functions
    version_str() and version()

  • DOC: Use *args instead of args... for Python variadic arguments

  • PORT: Fix Windows type issues.

  • COMPAT: py_add_lib_dir/1 to add new directory at the end.

  • ADDED: Prepend ‘.’ to the Python search path for interactive sessions
    Similar to Python, when Prolog is used interactively we add ‘’ (or
    ‘.’) to sys.path as first element. Prints an informational
    message when this happens.

    Note that adding . for non-interative sessions is undesirable for
    security reasons: unaware users of an application may trigger the
    execution of code that happens to be in the current directory.

Package xpce

  • CLEANUP: Avoid duplication between library(prolog_xref) and
    library(pce_prolog_xref)

  • ADDED: GUI tracer settings: allow setting ellipses length for text.

2 Likes

FWIW, the issue with 9.1.20, Intel Mac:

Replacing the 9.1.20 version of the SWI-Prolog executable with the 9.1.19 version did indeed fix the problem AFAICT.

presumably due to new xcode tools, is no longer a problem on 9.1.21 (??).

Good to hear :slight_smile: I have no clue. I didn’t make any changes to the swipl-win code. I didn’t update Xcode and the release builds are always full (non-incremental) builds. Must be the position of Pluto relative to Mars :slight_smile:

root@mx:/usr/local/swipl-devel/build# swipl --version
SWI-Prolog version 9.1.21 for x86_64-linux

:+1:

This is a little obscure…do you mean that you feel like a dwarf planet in comparison to a war machine? :sweat_smile:

Since I installed 9.1.21 of SWI-Prolog, invoking the reload modified
files menu item, does rebuild indexes:

?- 
% Updating index for library d:/software2/logic/swipl/library/
% Updating index for library d:/software2/logic/swipl/library/ext/archive/
% Updating index for library d:/software2/logic/swipl/library/ext/bdb/`
Etc..

When I do reload modified again I get again these messages:

?- 
% Updating index for library d:/software2/logic/swipl/library/
% Updating index for library d:/software2/logic/swipl/library/ext/archive/
% Updating index for library d:/software2/logic/swipl/library/ext/bdb/
Etc..

Shouldn’t the second messages be supressed.

In theory yes. make/0 for program source files only considers files for reloading if their modification time is at least 1ms more recent than when the file was loaded. This was needed to stop Windows reloading the file over and over again. Now added that 1ms tolerance to the library index as well. It is rather unclear to me why this is needed. On Linux one gets exactly the same value when asking for the last modified time of a file if the file was not modified.

There is a second bug. Try reload modified files. And then try for example:

?- edit(append).

It will give you:

ERROR: d:/software2/logic/swipl/xpce/prolog/lib/hyper.pl:59:
ERROR:    Trying to load class partof_hyper recursively
Etc...

And many more errors, and not starting the editor.

It was something I’ve seen before but was too lazy to fix. Should be fixed now. Should not affect too many users as the library index should normally not be writable by the user in a global installation, which blocks trying to update it. And on all systems but Windows make/0 updates the library index only once AFAIK.