Ann: SWI-Prolog 9.3.15

Dear SWI-Prolog user,

SWI-Prolog 9.3.15 is ready for download. It comes with some
(portability fixes), introduction of SSU for DCG using Head ==> Body
and various updates to printing numeric values including support for
printing integers with “grouping” in the toplevel and debugger. Some
of the formatting is under discussion as PIP-105 and may (and probably
will) change.

Highlights:

  • Added library(prolog_locale), providing setup_prolog_integer_grouping/0.
    This allows for this in your init.pl after which big integers are
    written as 1_234_456, etc in the toplevel and debugger.

    :- if(exists_source(library(prolog_locale))).
    :- setup_prolog_integer_grouping.
    :- endif.
    
  • Added write_term/2,3 options format_float(+Format) (SICStus
    compatibility) and format_integer(+Format). These issues are
    under discussion as PIP-105 and may change.

  • Added ~:D (colon modifier for D to use _ instead of
    , for digit grouping.

  • Added format/2 ~N[hH] specifier for compatiblity with SICStus.
    Provides writing floats with minimal digits for reading to the same
    float (as write/1), where N dictates when to us exponential
    notation or not.

  • Added Head ==> Body, providing SSU DCG rules. Notably comfortable
    for generative (serializing) DCG rules.

  • Cleanup and some possible fixes for prolog_trace_interception/4,
    the hook that drives the graphical debugger and SWISH debugger.
    Surely fixes some things, but unclear whether this fixes some
    infrequent SWISH crashes.

  • Some “pack” management fixes.

  • Implement distinct/1,2 and reduced/1,3 using tries.
    This reduces the overhead over 5 times

  • Dropped most of the visibility of the old C++ interface. The
    code is still there, so code relying on it still works.

  • Fedora 41 portability patches (hamcrest and latest OpenSSL BIO
    issue)

    Enjoy — Jan

SWI-Prolog Changelog since version 9.3.14

[Nov 18 2024]

  • FIXED: Handling return values in stack expansion. Introduce
    more bool to correctly distinguish functions returning
    true/false/*_OVERFLOW from those raising exceptions and only returning
    true/false.

  • FIXED: prolog_trace_interception/4: setting up the hook good crash.

[Nov 17 2024]

  • CLEANUP: Updated library(option). Updated documentation and make
    more use of => to capture type issues. merge_options/3 now also
    supports dicts.

  • ENHANCED: prolog_frame_attribute/3: Better argument validation.
    Also various minor cleanup (e.g., more bool).

  • FIXED: library(main): superfluous choice point in argv_options/3

[Nov 16 2024]

  • ADDED: format/2: support ~:D The colon modifier for D forces
    the use of Prolog digit grouping using _.

  • FIXED: format/2 handling of Unicode characters Regression from
    a49fe8cb40fc15b7325a4e4836304cbe6d9ccef0

[Nov 15 2024]

  • ADDED: library(prolog_locale) to setup grouped printing of integers.

  • ADDED: write_term/2 options format_float(+Format) and
    format_integer(+Format) Using a format seems a more sensible way to
    control writing numbers from write_term/2. This patch removes the
    previously introduced radix(+Radix) option. If we want this back we
    will implement it on top of format_integer(+Format).

    This patch also contains a lot of small code cleanup and some
    optimization
    to low-level I/O.

  • ADDED: write_term/2: option radix(Radix). Experimental. Under
    discussion as PIP-105. The current implementation writes, unlike XSB,
    the radix prefix. We either need more options or we should consider
    another alternative such as integer_format(+Format)

    As this patch cleans up a lot of the code regarding numeric output and
    most will be needed anyway, it is merged despite the fact that the
    radix option may vanish eventually.

[Nov 14 2024]

  • ADDED: format/2 specifier ~h This provides compatibility to
    SICStus. It also makes write/1 output for floats compatible to SICStus
    for deciding between fixed point and exponential notation.

  • FIXED: ISO compatible parsing for fy 2 yf and similar cases.

[Nov 13 2024]

  • TEST: Added ISO ambiguous operator tests. Marked two tests as blocked
    as these currently fail.

[Nov 8 2024]

  • FIXED: #1331 Module issue in SICStus block/1 emulation. This patch
    also reformats the file, removes some dead code and remove the outdated
    restriction that it does not work on dynamic or foreign predicates.

[Nov 6 2024]

  • ENHANCED: Avoid spurious tracing in push_msg/2.

  • DEBUG: First print the Prolog stack “safe” on a crash. This guarantees
    that the stack is printed, including details on the clauses involved
    and progress in each clause. Next, the stacks are printed with
    arguments. This however may crash if the crash is caused by corrupt
    data on the stacks.

[Nov 5 2024]

  • ADDED: Support SSU DCG rules as Head[, Guard] ==> DCGBody.

  • FIXED: libary(prolog_pack): detection of valid download URLs.

  • FIXED: Build order planning. This reverts
    1cf4acbe722604857a2627ecc161f80e16f330ed. That patch was broken.
    The reported failure probably had some other cause.

[Nov 4 2024]

  • FIXED: Installing a pack should attach the pack itself. This
    incorrectly registered the directory of the pack as a directory that
    provides packs instead.

  • ENHANCED: explain/1 to enumerate all instances of a non-qualified
    predicate.

  • TEST: rwlocks unit tests for safety and reliability

[Nov 3 2024]

  • BUILD: plunit requires clib package.

[Nov 1 2024]

  • ENHANCED: Implement distinct/1,2 and reduced/1,3 using tries.
    This reduces the overhead over 5 times.

Package bench

[Nov 13 2024]

  • FIXED: Avoid division by zero if no tests are executed.

Package cpp

[Nov 2 2024]

  • DEPRECATED: Officially deprecate version 1 of the C++ interface.
    For now, we will keep SWI-cpp.h in the distribution. We do not plan
    any updates to keep it in sync with changes to SWI-Prolog or the
    C++ standard. Users of this old interface are strongly encouraged
    to update their program.

  • DOC: removed all “(version 2)”

  • DOC: Delete documentation for version 1 of the C++ interface

Package jpl

[Nov 14 2024]

  • TEST: Fix finding hamcrest on Fedora 41

Package plunit

[Nov 6 2024]

  • ENHANCED: PlUnit message for tests that succeed with a choicepoint.

Package ssl

[Nov 17 2024]

  • PORT: Extended our BIO_ctrl() callback. In Fedora 41, OpenSSL
    3.2.2, it appears we need to implement the BIO_ctrl() methods
    BIO_C_FILE_TELL and BIO_C_FILE_SEEK for properly loading keys
    from files.
1 Like

Hello !

This is amazing ! Is there some documentation for this ?
I’ll make sure to try this in my c generation grammar :slight_smile:

Ah, and does this mean that push back list are incompatible with ==> ?

I found this bit in the documentation: SWI-Prolog -- Single sided unification for Definite Clause Grammars

1 Like

Note that especially the stuff between the head and the ==> is not set in stone as far as I’m concerned. If there are better options, let me know.

I vaguely recall that the current ISO proposal for DCGs only allows for a push-back list, which would the choices for ==> safe. The current SWI-Prolog DCG allows for an arbitrary DCG body term in the place of a push-back list, making the current choice ambiguous. Does anyone have the details?

Another interpretation would be to use terms between the Head and ==> as DCG body terms that parse and are used as guards. I don’t see a good use case though as I see no value in SSU on the Head in that case. If anyone finds use cases that ask for reconsidering the choices, please post them (in new topic?)