SP_fail()would sometimes not be handled correctly when foreign code called Prolog recursively. Now, exceptions are preserved in callbacks from foreign functions.
format/[2,3]et al. used to treat all non-reserved exceptions as consistency errors. Now non-error exceptions, i.e. not
error/2, are passed on to the caller.
Reserved exceptions from the goal invoked for the `~@' spec are
now passed on to the caller. This ensures that
timeout:time_out/3 and other interrupts will be able to
terminate such a goal.
tell/1would not accept stream objects.
set_prolog_flag/2. These issues affected
current_stream/3and could lead to access to freed memory during
stream_property/2no longer returns an
eol/1property for binary streams.
getenv()if several SICStus runtimes where initialized at the same time in different threads of the same process. See below for the new concept “System Properties”, which has replaced most uses of environment variables.
SP_event()handlers are no longer allowed to run when the sicstus run-time calls prolog code in contexts where their result, e.g. failure or exception, can not be propagated to the caller. This could potentially lead to timeouts and other asynchronous events being ignored.
open/4fails to open a file for writing, it will now generate a
permission_error/3error, as prescribied by the ISO Prolog standard. It used to raise a system error.
if_exists(generate_unique_name)would sometimes access and use freed memory when generating a new file name.
SP_get_list_n_codes()would report more bytes written than what was actually written.
initialization/1now have access to the load context (
prolog_load_context/2), similarly to how other goals appearing in directives are treated. This also means that
absolute_file_name/2will use the location saved in the load context as default directory.
Please note: The change in default directory for
absolute_file_name/2, and thus
open/[3,4] et al., is an
incompatible change that may affect some programs. Old code that depends
on the current directive may need to be rewritten to explicitly call
If the old code looked like:
%% Pre 4.1.0 version :- initialization read_some_file('myfile').
it can be rewritten as follows (which will also work in older versions of SICStus Prolog):
%% >= 4.1.0 version :- use_module(library(file_systems), [current_directory/1]). :- initialization current_directory(CWD), absolute_file_name('myfile', Absfile, [relative_to(CWD)]), read_some_file(Absfile).
prolog_load_context(stream,S)will now only succeed when compiling or consulting the code. It used to return a closed stream instead of failing.
nvalue/2would miss solutions.
element/3did not maintain arc-consistency in its first argument.
copy_term/3was sometimes incomplete or not correct.
directory_member_of_directory/2, no longer fail if they encounter a broken symbolic link.
library(process): Process creation would leak small amounts of memory.
maybe/0would always fail the first time.
library(xref): slighly more precise.
sockets:socket_client_open/3would give system error with
SPIO_E_HOST_NOT_FOUNDwhen connecting to localhost on some platforms.
system:environ/2would leak memory if called with a variable as first argument.