Ann: SWI-Prolog 9.3.7

Dear SWI-Prolog user,

SWI-Prolog 9.3.7 is ready for download. This is mainly a bugfix
and portability release. Highlights:

  • By default, “Named anonymous variables”, i.e., starting with
    an underscore, followed by a capital letter (_List) are
    shared (as dictated by the standard), but the toplevel by
    default no longer prints their value. Controlled by the
    Prolog flag toplevel_print_anon.

  • The toplevel generated variable names now avoid conflicts
    with user variables.

  • @peter.ludemann added support for Python context managers to
    Janus, providing reliable cleanup of Prolog queries.

  • thread_send_message/3 and thread_get_message/3 now have a
    signals option that controls whether and how often they
    poll for signals. It turns out the polling is rather slow
    on MacOS, causing prohibitive slowdown if more than a few
    hundred threads are waiting on a queue.

  • Time management is now robust against files that are reported
    to be modified at the epoch (Jan 1 1970). This is needed
    to allow running in Linux Flatpak images.

  • The HTTP server got support for “Server-Sent events”, content
    type event-stream.

    Enjoy — Jan

SWI-Prolog Changelog since version 9.3.6

  • ENHANCED: call_in_thread/2 error handling.

  • TEST: test_interrupt: skip test if alert signals are required but
    they are disabled.

  • DOC: fix typo and improve cmake instructions

  • FIXED: thread_create/3: handling of c_stack option. While the
    size was documented to be in K-bytes, it actually is in bytes.
    Updated the docs for that. Allow for c_stack(0) to use the mininum.

  • ADDED: thread_get_message/3 and thread_send_message/3:
    signals(BoolOrTime) option.

  • MODIFIED: Change default for the Prolog flag toplevel_print_anon.
    This flag is now by default false, hiding toplevel variables that
    start with an underscore.

  • FIXED: Generating variable names may conflict with user variables.

  • FIXED: Links to FAQ pages.

  • FIXED: Trie handling of floats on 32-bit hardware

  • CMAKE: Fixed -DCMAKE_BUILD_TYPE=Sanitize Defaults to
    -fsanitize=address.

  • FIXED: Enabled pre-check for left-shift of large integers This both
    avoids possible GMP exceptions and allocating huge amounts of memory.

  • ENHANCED: Clarify shifting negative integers This patch also avoids
    relying on undefined C behavior.

  • FIXED: shift (<< and >>) of zero.

  • FIXED: Handle source files with epoch time stamp Flatpak seems to
    set the modification time of all times in the sandbox to the epoch
    (0). This was used as a special value to indicate the source file
    was not a file. We now keep a seperate flag and use the integer
    0 to indicate something is not a source file in the Prolog world.
    It is probably better to use something else, but this avoids type
    issues in possibly unknown dependent code.

Package clib

  • DOC: change example to use stream pairs

Package http

  • FIXED: Failure to serve data with unknown mime type.

  • DOC: Server-sent events support

  • ADDED: Support for server-sent events These patches allow for
    streaming output which is enabled by default if the content-type is
    text/event-stream. Still needs documenting.

Package jpl

  • TEST: Search for junit.jar as well as junit4.jar. Fedora only ships
    with junit.jar. We’ll assume version 3 and older have died by
    this time.

Package swipy

  • ENHANCED: Context manager for janus.query() + tests for doc examples

  • FIXED: #9 PrologError exceptions cannot be caught as
    janus.PrologError

  • FIXED: py_is_object/1: Need to grab the GIL

1 Like

I thought the _X below is a toplevel shared anonymous variable but attribute variable seems not ruled by
the set_prolog_flag/2. In other words, it seems that attribute variable can not be a toplevel variable. My purpose is to always suppress output putt_attr(X, module, V) where attribute of X
is not interested for my application.

?- set_prolog_flag(toplevel_print_anon,false).
true.

?- _X = 1.
true.

?- put_attr(_X, zsat, 1).
put_attr(_X, zsat, 1).

This is the same as When a new variable is created it can clash with existing variables (maybe not) - #12 by ridgeworks