Version 8.1.1 available

Dear Prolog user,

I have uploaded SWI-Prolog 8.1.1. There is a lot to enjoy. Highlights:

  • FIXED: the MacOS bundle: menu handling in SWI-Prolog.app and make
    xpce work again (hopefully). With help from `ridgeworks’ and
    Carlo Capelli. Both were regressions due to the migration to
    CMake.

  • ENHANCED: delete lingering clause indexes older than the oldest
    active predicate access. Keri Harris implemented a big enhancement
    getting rid of old clause indexes for dynamic predicates that are
    repeatedly filled with many clauses, queried and emptied and almost
    continuously active.

  • ENHANCED: avoid uneeded garbage collection when catching exceptions
    that are not related to stack overflows. Can be a bit performance
    improvement for applications using a lot of exceptions in their
    normal computation.

  • XSB: Started investigating XSB/SWI-Prolog options for cooperation.
    This added (still very limited) support for
    :- expects_dialect(xsb) and loading XSB .P files (in XSB emulation
    mode). Enabled by Kyndi.

  • PORT: .QLF files and saved states are now word-length independent.
    This means they are machine (OS, CPU) independent, but still depend
    on the Prolog VM that can change between versions.

    Erlanger added support for including foreign plugins for multiple
    architectures in saved states. This is part of ongoing work by
    Erlanger to generate Android APK installers from Prolog.

  • ADDED: HTTP server: deal with rest locations as discussed here and
    pioneered by Raivo Laanemets.

And of course the usual set of small fixes and enhancements.

Enjoy --- Jan

SWI-Prolog Changelog since version 8.1.0

  • XSB: Started intern library emulation.

  • PORT: Force compiling and linking against XQuartz on MacOS when
    creating a bundle.

  • ENHANCED: delete lingering clause indexes older than the oldest active
    predicate access

  • ENHANCED: Do not request a garbage collection after an exception
    unless we ran out of stack on a stack that is subject to GC.

  • ENHANCED: No longer perform forced GC before calling the user exception
    hook. GC is allowed inside the hook, so there is no reason to do so.

  • MODIFIED: No longer use print_message/2 for trace_gc. If GC happens
    in some parts inside the VM we cannot handle calls to Prolog safely.

  • FIXED: Only check that an async signal handler created an
    exception.

  • XSB: Added dummy abolish_table_info/0.

  • FIXED: SWI-Prolog refuses to export ISO predicates, so we cannot
    import them either. This isn’t needed anyway.

  • FIXED: Make sure closing a zipper twice does not open the stream twice.

  • XSB: completed basics.pl emulation

  • TEST: Avoid name clash in tabling tests.

  • ENHANCED: Verify a predicate has no clauses when :- table is declared.

  • XSB: Partially emulate compiler options.

  • CLEANUP: Avoid truncating in abs(ssize_t) (benign).

  • FIXED: Issue#82: Throw a floating point exception when NaN/Inf floats
    need to be converted to an integer.

  • XSB: Support modified libraries with the same name.

  • XSB: Improve :- import … from … emulation.

  • FIXED: Pretend begin_of_file is expanded from line 0 instead of
    make source_location/2 fail.

  • XSB: Deal with .H files.

  • XSB: Support operators mode and export. Make import look for modules
    relative to the current dir.

  • FIXED: Moved setting the SIGINT handler from resetTracer() to
    initTracer() so it won’t reinstall the default SIGINT handler on
    abort if the user changed the binding.

  • FIXED: on_signal/3 handling of throw. Peter Ludemann.

  • PORT: Prolog flags for android

  • DOC: qsave_progam/2: updated foreign(+Action)

  • PORT: set proper android arch

  • ADDED: Multi and cross-architecture shlib support for saved states

  • FIXED: qsave_program/2: deal with prolog and default
    toplevels. Keri Harris.

  • FIXED: add -rdynamic to cflags to export symbols (fix #420) Only do
    this if we do not put the Prolog core in a shared object. * After
    cmake 3.4 -rdynamic is not added when building a
    target. This breaks the android termux build. This patch
    solves the problem.

  • TEST: Fixed test that broke due to assert to a static procedure
    unrelated to the test.

  • FIXED: Issue#81: assert/1 and friends must produce a permission error
    if the predicate is not dynamic and defined.

  • XSB: Added load_dyn/1,2 and load_dync/1,2.

  • FIXED: in_temporary_module/3: destroy the load context for files
    loaded into this module.

  • XSB: Partial compile/2 emulation.

  • HACK: Use (index)/1 instead of index/1 to avoid a conflict with XSB
    index operator. It is unclear how to guarantee that the first term
    of a source file is always read as intended.

  • FIXED: Allow qcompile/1 on files with a different implicit Prolog
    extension.

  • PORTABILITY: Started XSB dialect specification.

  • FIXED: prolog_load_context/2 to provide the correct file, source
    and directory before the first term.

  • ADDED: term_expansion/2,4: add pseudo term begin_of_file to the
    expansion stream.

  • FIXED: load_files/2: Added predicate option declaration for
    dialect(+Dialect)

  • CLEANUP: Move saved state generation to library(qsave) to simplify
    init.pl

  • ENHANCED: Removed conditional code from the boot file. This ensures
    we have the same boot file regardless of the machine, simplifying
    cross compilation.

  • CLEANUP: Name the boot file simply boot.prc as it no longer depends
    on the word-size.

  • ADDED: Prolog flag portable_vmi.

  • CLEANUP: Proper range test (LONG_MAX -> INPTR_T_MAX)

  • DOC: Updated expand_term/2 documentation.

  • FIXED: possible crash when loading saved states that contain procedures
    with NULL modules

  • PORT: Generate i386 binaries on x86_64 Debian based Linux systems.

  • BUILD: Updated minimum CMake version required to 3.5

  • DOC: qsave_program/2: fix stack size documentation. Keri Harris.

  • DIST: added packages/windows directory to source archive. Keri Harris

Package archive

  • ADDED: archive_foldl/4

Package clib

  • DOC: Fixed a small typo in chmod/2 documentation.

Package http

  • DOC: library(http/http_client), option json_object(dict).
    Joost Geurts.

  • MODIFIED: Issue#422: json_read/3 and friends no longer read the
    character that follows the JSON document, allowing for concatenated
    JSON
    .

  • FIXED: json_read_dict/2,3: allow options to define arbitrary terms
    for true, false, null and end_of_file.

  • ADDED: json_read/3 and friends, option end_of_file(+Action), where
    Action is either the atom error, throwing a syntax error or any
    other term, returning this term if the end of the input is encountered
    after skipping white space but before any data.

  • ADDED: Simplify generating a URL that refers to a REST location
    declared using a path pattern in http_handler/3. This affects
    http_location_by_id/2, http_link_to_id/3, http_redirect/3 and attribute
    value notation used by library(http/html_write).

  • MODIFIED: http_handler/3: force Id in id(Id) to be an atom.
    Previous versions accepted any Prolog term. This provides for
    extending http_location_by_id/2 to become more REST friendly.

  • EXAMPLES: Updated demo daemon script and systemd service example.

Package jpl

  • COMPAT: Boot file is always boot.prc (used for testing).

Package nlp

  • FIXED: tokenize_atom/2 when the atom contains an illegal number could
    result in a variable (unbound) extra token in the output.

Package sgml

  • ADDED: xpath/3: text(string) to get the DOM text as a string rather
    than an atom.

  • FIXED: xpath/3: make extraction work if the document was parsed
    using cdata(string).

Package swipl-win

  • FIXED: Issue#83: Qt console menu handling. This issue was due to
    omitted resources in the cmake build. Note that this does not fix
    the X11 problems of the MacOS bundle reported in the same issue.

Package table

  • DOC: add table package docs
2 Likes

Colllaboration with XSB sounds very interesting, but also challenging.

From what I understand, XSB prolog is underpinned by a logic-semantic approach that is different to standard (swi) prolog.

Would swi-prolog, in the future, support such advanced semantic capabilities such as real logic negation, defeasibility, etc.

thanks,

Dan

The advanced tabling stuff is exactly what we want to make available to SWI-Prolog. The route is not yet decided. I’m currently implementing an XSB dialect layer that allows us to run the XSB test suite to get an idea about what is missing and how good/bad the parts that are in SWI are.

that’s great.

btw, …

I first had tried XSB and in particular its flora-2 extension, but eventually decided to use swi-prolog. First, because the swi-prolog community is much more active (and accessible, in my opinion), and because Flora-2 was very slow, once I extensively used advanced features.

XSB was also sometimes unintuitive to me – its semantics (such as transactional semantics) had a learning curve with subtle issues (again IMHO).

Dan

Running and comparing the results of the Logtalk bundled tests on SWI-Prolog and XSB, in particular for the Prolog compliance test suite, helps highlighting the differences between the two systems. A test passing in one system and failing in the other system alerts to a potential compatibility issue when trying to run code written for the first system in the second system.

Right, but i would imagine that XSB feature set is a superset of both SWI and Logtalk

No. The feature sets of XSB and SWI-Prolog intersect without one subsuming the other. Logtalk extends and runs on both systems and none of them provide sensible/effective alternatives to its key features.

thanks,

I am curious, from your experience, how does the picture look like when considering flora-2 as well.

I guess, Flora-2 is a frame based system, but doesn’t have any notions of objects in the sense of encapsulation and message passing and polymorphism.

But, i think the strongest claim (selling point) of XSB is its semantic foundation – i would imagine that this is where the key difference, and potential augmentation, need to be sought

thanks,

Daniel

And the whole point of this project is make the intersection larger, first of all by making key functionality available in one system available in the other. The overall idea is not so much to make the system fully compatible, but to facilitate porting applications both ways.

This means porting some of the key tabling functionality to SWI and providing some of the threading and foreign language facilities to XSB.

I agree that Flora-2 is best described as a frame system, focused on knowledge representation, rather than object-oriented system, specially when considering, as you mention, common OO features.

XSB have advanced tabling features, as Jan just mentioned, that would be useful to have in SWI-Prolog. One the other hand, SWI-Prolog have reliable features such as multi-threading, which are buggy in XSB. Then there are other features in XSB like HiLog and Semantic models, which, as you mentioned, are selling points for it and leveraged in Flora-2. My understanding is that this is the main reason why Flora-2 only supports XSB.

If i understood it correctly, I think tabling is the key technology underpinning the semantics of XSB prolog, including the ability to create true logic negation – i.e. asserting when something is known not to be the case – as opposed to negation as failure.

So, i am wondering, if full tabling support is introduced into swi-prolog, if this could then also lead to an extension to support XSBs semantics – perhaps, analogous to pure prolog – a style one can adopt.

I think such an extension could be very valuable.

Dan