SP_raise_exception()
and 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.
see/1
and tell/1
would not accept stream objects.
user_input
, user_output
, and user_error
) with
set_prolog_flag/2
. These issues affected stream_property/2
,
current_stream/3
and could lead to access to freed memory during
close/[1,2]
.
stream_property/2
no longer returns an eol/1
property for
binary streams.
getenv()
if several SICStus runtimes were 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/4
fails to open a file for writing, it will now
generate a permission_error/3
error, as prescribied by the ISO
Prolog standard. It used to raise a system error.
open/4
option 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/1
now 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/2
will 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
file_systems:current_directory/1
.
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.
library(clpfd)
:
nvalue/2
would miss solutions.
element/3
did not maintain arc-consistency in its first argument.
fd_global/[3,4]
.
copy_term/3
was sometimes incomplete or not correct.
file_systems:file_must_exist/[1,2]
, lists3:nextto/3
,
lists3:nth/4
.
library(file_systems)
,
e.g. 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.
library(random)
: maybe/0
would always fail the first time.
library(detcheck)
from working.
library(xref)
: slighly more precise.
sockets:socket_client_open/3
would give system error with
SPIO_E_HOST_NOT_FOUND
when connecting to localhost on some
platforms.
system:environ/2
would leak memory if called with a variable as
first argument.