We have removed is
as a synonym for unification.
We have reserved =<
/2 as a type name.
A term with a top-level functor coerce/1
is now treated as a type conversion expression. To call a function named coerce/1
, you can module qualify the name at the call site, or wrap parentheses around the name, e.g. (coerce)(Arg)
.
We have renamed the lexer
and parser
modules of the Mercury standard library to mercury_term_lexer
and mercury_term_parser
respectively.
We have made slight changes to the names and/or the functionality of several predicates in the getopt
and getopt_io
modules.
We have removed the legacy support for the Alpha architecture.
We have dropped support for macOS 10.8 and earlier.
We have removed the Erlang backend as it was unmaintained.
random.system_rng
array
moduleThe following obsolete predicates and functions have been removed:
bsearch/3
(replacement: binary_search/3
)bsearch/4
(replacement: binary_search/4
)least_index/1
(replacement: min/1
)greatest_index/1
(replacement: max/1
)The following predicate has been added:
generate_foldl2/7
array2d
moduleThe following predicates and functions have been added:
lookup/3
(synonym for Array ^ elem(R, C)
)lookup/4
(synonym for Array ^ elem(R, C)
)unsafe_lookup/3
(synonym for Array ^ unsafe_elem(R, C)
)unsafe_lookup/4
(synonym for Array ^ unsafe_elem(R, C)
)The lists/1
function now returns an empty list for a 0x0 array.
assoc_list
moduleThe following predicates and functions have been added:
common_subset/2
maybe_from_corresponding_lists/3
bag
moduleThe following obsolete predicates and functions have been removed:
to_set_without_duplicates/1
(replacement: func to_set/1
)to_set_without_duplicates/2
(replacement: func to_set/1
)bitmap
moduleThe following predicates and functions have been added:
get_bit/2
get_bits/2
get_byte/2
set_bit/4
set_bits/4
set_byte/4
unsafe_get_bit/2
unsafe_get_bits/2
unsafe_get_byte/2
unsafe_set_bit/4
unsafe_set_bits/4
unsafe_set_byte/4
char
moduleThe following predicates have been added:
unsafe_base_digit_to_int/3
to_utf8_uint8/2
to_utf16_uint16/2
The following obsolete predicates and functions have been removed:
det_int_to_digit/1
(replacement: det_int_to_decimal_digit/1
)det_int_to_digit/2
(replacement: det_int_to_decimal_digit/2
)digit_to_int/2
(replacement: decimal_digit_to_int/2
)int_to_digit/2
(replacement: int_to_decimal_digit/2
)cord
moduleThe following predicates have been added:
foldl2/6
foldl3/8
dir
moduleThe following predicate has been added:
general_foldl2/8
getopt
moduleThe following new predicates have been added:
record_arguments/8
expand_file_specials/8
The following variants of the existing process_options predicate have been added:
process_options_io/6
process_options_io/7
process_options_track_io/9
process_options_userdata/8
process_options_userdata_io/10
The ones whose names have an _io
suffix do the same jobs as the corresponding predicates without the _io
suffix, with the exception that they also have a pair of I/O state arguments that allow them to implement file_special
options. This functionality used to be available only from the getopt_io
module.
The following predicates have had their argument types changed:
process_options/6
process_options/7
process_options_track/7
All these predicates used to return error indications in the form of a simple string. They now return error indications using the existing structured type option_error
, which can be converted into a string on demand.
The following predicates have been deleted:
process_options_se/6
process_options_se/7
process_options_track_se/7
Their functionality is now available from the predicates with the same name minus the _se
suffix.
getopt_io
modulegetopt
module, but it is scheduled to be deleted after the next release.int
moduleThe following functions have been added:
uint_to_lc_hex_string/2
(synonym for uint_to_hex_string/2
)uint64_to_lc_hex_string/2
(synonym for uint64_to_hex_string/2
)The following obsolete predicates and functions have been removed:
is/2
(replacement: =
, i.e. unification)legacy_left_shift/2
(replacement: <<
)legacy_right_shift/2
(replacement: >>
)int32
moduleThe following functions have been added:
cast_to_int8
cast_from_int8
cast_to_int16
cast_from_int16
cast_to_int64
cast_from_int64
integer
moduleThe following obsolete functions have been removed:
from_base_string/2
(replacement: pred from_base_string/3
)from_string/2
(replacement: pred from_string/2
)int/2
(replacement: det_to_int/1
)io
moduleThe following predicates have been added to this module:
get_environment_var_map/3
read_binary_int8_unboxed/5
read_binary_uint8_unboxed/5
read_named_file_as_string/4
read_named_file_as_lines/4
write_line_cc/4
The following obsolete predicates have been removed:
make_temp/3
(replacement: make_temp_file/3
)make_temp/5
(replacement: make_temp_file/5
)The following predicates have been marked as obsolete:
see/4
(replacement: prolog.see/4
)see_binary/4
(replacement: prolog.see_binary/4
)seen/2
(replacement: prolog.seen/2
)seen_binary/2
(replacement: prolog.seen_binary/2
)tell/4
(replacement: prolog.tell/4
)tell_binary/4
(replacement: prolog.tell_binary/4
)told/2
(replacement: prolog.told/2
)told_binary/2
(replacement: prolog.told_binary/2
)The following predicate has been renamed:
report_stats/2
to report_standard_stats/2
.lexer
modulemercury_term_lexer
, to make name clashes between it and user-written modules less likely.list
moduleThe following predicates have been added:
delete_nth/3
foldl7/16
foldl8/18
foldl4_corresponding/11
The following obsolete predicate has been removed:
takewhile/4
(replacement: take_while/4
)map
moduleThe following predicates have been added to this module:
foldl6/14
foldl6_values/14
foldr6/14
maybe
moduleThe following predicates have been added to this module:
foldl3_maybe/8
foldl4_maybe/10
foldl5_maybe/12
map_foldl4_maybe/11
map_foldl5_maybe/13
parser
modulemercury_term_parser
, to make name clashes between it and user-written modules less likely.prolog
moduleThe following predicate has been added to this module:
is/2
(moved here from the int
module)see/4
(moved here from the io
module)see_binary/4
(moved here from the io
module)seen/2
(moved here from the io
module)seen_binary/2
(moved here from the io
module)tell/4
(moved here from the io
module)tell_binary/4
(moved here from the io
module)told/2
(moved here from the io
module)told_binary/2
(moved here from the io
module)random
moduleThe following obsolete predicate has been removed:
test/4
(replacement: none)std_util
moduleThe following obsolete predicates and functions have been removed:
maybe_func/2
(replacement: func maybe.func_to_maybe/1
)maybe_pred/3
(replacement: func maybe.pred_to_maybe/1
)string
moduleThe following functions have been added:
add_suffix/2
split_into_lines/1
to_uint/2
det_to_uint/1
base_string_to_uint/3
det_base_string_to_uint/2
uint_to_hex_string/1
uint_to_uc_hex_string/1
uint_to_octal_string/1
uint64_to_hex_string/1
uint64_to_uc_hex_string/1
uint64_to_octal_string/1
The following function symbols have been added to the type poly_type
:
i8(int8)
i16(int16)
i32(int32)
i64(int64)
u8(uint8)
u16(uint16)
u32(uint32)
u64(uint64)
This allows predicates such as string.format
and io.format
to operate on values of not just the word sized integer types int
and uint
, but on sized versions of them as well.
term
moduleThe following obsolete predicates and functions have been removed:
func var_id/1
(replacement: var_to_int/1
)
relabel_variable/3
(replacement: rename_var_in_term/4
)relabel_variable/4
(replacement: rename_var_in_term/4
)relabel_variables/3
(replacement: rename_var_in_terms/4
)pred relabel_variables/4
(replacement: rename_var_in_terms/4
)
rename/3
(replacement: rename_var_in_term/4
)rename/4
(replacement: rename_var_in_term/4
)rename_list/3
(replacement: rename_var_in_terms/4
)pred rename_list/4
(replacement: rename_var_in_terms/4
)
apply_renaming/3
(replacement: apply_renaming_in_term/3
)apply_renaming/3
(replacement: apply_renaming_in_term/3
)apply_renaming_to_list/3
(replacement: apply_renaming_in_terms/3
)pred apply_renaming_to_list/3
(replacement: apply_renaming_in_terms/3
)
apply_variable_renaming/2
(replacement: apply_renaming_in_term/3
)apply_variable_renaming/3
(replacement: apply_renaming_in_term/3
)apply_variable_renaming_to_list/2
(replacement: apply_renaming_in_terms/3
)pred apply_variable_renaming_to_list/3
(replacement: apply_renaming_in_terms/3
)
apply_variable_renaming_to_var/2
(replacement: apply_renaming_in_var/3
)apply_variable_renaming_to_var/3
(replacement: apply_renaming_in_var/3
)apply_variable_renaming_to_vars/2
(replacement: apply_renaming_in_vars/3
)pred apply_variable_renaming_to_vars/3
(replacement: apply_renaming_in_vars/3
)
substitute/3
(replacement: substitute_var_in_term/4
)substitute/4
(replacement: substitute_var_in_term/4
)substitute_list/3
(replacement: substitute_var_in_terms/4
)pred substitute_list/4
(replacement: substitute_var_in_terms/4
)
substitute_corresponding/3
(replacement: substitute_corresponding_in_term/4
)substitute_corresponding/4
(replacement: substitute_corresponding_in_term/4
)substitute_corresponding_list/3
(replacement: substitute_corresponding_in_terms/4
)pred substitute_corresponding_list/4
(replacement: substitute_corresponding_in_terms/4
)
apply_substitution/2
(replacement: apply_substitution_in_term/3
)apply_substitution/3
(replacement: apply_substitution_in_term/3
)apply_substitution_to_list/2
(replacement: apply_substitution_in_terms/3
)pred apply_substitution_to_list/3
(replacement: apply_substitution_in_terms/3
)
apply_rec_substitution/2
(replacement: apply_rec_substitution_in_term/3
)apply_rec_substitution/3
(replacement: apply_rec_substitution_in_term/3
)apply_rec_substitution_to_list/2
(replacement: apply_rec_substitution_in_terms/3
)pred apply_rec_substitution_to_list/3
(replacement: apply_rec_substitution_in_terms/3
)
thread
moduleThe following predicate and functions have been added:
init_thread_options/0
set_min_stack_size/3
spawn_native/5
thread.mvar
moduleThe following obsolete function has been removed:
init/1
(replacement: impure_init/1
)thread.semaphore
moduleThe following obsolete function has been removed:
init/1
(replacement: impure_init/1
)time
moduleThe following obsolete functions have been removed:
ctime/1
(replacement: localtime/4
and asctime/1
)localtime/1
(replacement: localtime/4
)mktime/1
(replacement: mktime/4
)tree234
moduleThe following predicates have been added to this module:
foldl6/14
foldl6_values/14
foldr6/14
uint16
moduleThe following functions have been added:
from_uint/2
det_from_uint/1
cast_from_uint/1
rotate_left/2
rotate_right/2
unchecked_rotate_left/2
unchecked_rotate_right/2
set_bit/2
unchecked_set_bit/2
clear_bit/2
unchecked_clear_bit/2
flip_bit/2
unchecked_flip_bit/2
bit_is_set/2
unchecked_bit_is_set/2
bit_is_clear/2
unchecked_bit_is_clear/2
cast_from_uint8/1
cast_to_uint8/1
uint32
moduleThe following functions have been added:
from_uint/2
det_from_uint/1
rotate_left/2
rotate_right/2
unchecked_rotate_left/2
unchecked_rotate_right/2
set_bit/2
unchecked_set_bit/2
clear_bit/2
unchecked_clear_bit/2
flip_bit/2
unchecked_flip_bit/2
bit_is_set/2
unchecked_bit_is_set/2
bit_is_clear/2
unchecked_bit_is_clear/2
cast_from_uint8/1
cast_to_uint8/1
cast_from_uint16/1
cast_to_uint16/1
uint64
moduleThe following functions have been added:
cast_from_uint/1
rotate_left/2
rotate_right/2
unchecked_rotate_left/2
unchecked_rotate_right/2
set_bit/2
unchecked_set_bit/2
clear_bit/2
unchecked_clear_bit/2
flip_bit/2
unchecked_flip_bit/2
bit_is_set/2
unchecked_bit_is_set/2
bit_is_clear/2
unchecked_bit_is_clear/2
cast_from_uint8/1
cast_to_uint8/1
uint8
moduleThe following functions have been added:
from_uint/2
det_from_uint/1
cast_from_uint/1
rotate_left/2
rotate_right/2
unchecked_rotate_left/2
unchecked_rotate_right/2
set_bit/2
unchecked_set_bit/2
clear_bit/2
unchecked_clear_bit/2
flip_bit/2
unchecked_flip_bit/2
bit_is_set/2
unchecked_bit_is_set/2
bit_is_clear/2
unchecked_bit_is_clear/2
varset
moduleThe following obsolete predicates have been removed:
merge_subst/4
(replacement: merge_renaming/4
)merge_subst_without_names/4
(replacement: merge_renaming_without_names/4
)The following functions and predicates have been added:
unname_var/2
unname_var/3
undo_default_names/2
The type system now supports subtypes, which work in tandem with type conversion expressions (“coerce”). For example, the following defines a subtype real_color
of a discriminated union type color
:
:- type color
---> rgb(float, float, float)
; cmyk(float, float, float, float)
; named(string).
:- type real_color =< color
---> rgb(float, float, float)
; cmyk(float, float, float, float).
A term of type real_color
can be converted to a term of type color
with coerce(Term)
. A term of type color
can be converted to a term of type real_color
if it has an appropriate inst. Subtypes share a common data representation with their base types, so the type conversions do not cost anything at runtime.
Field names no longer need to be unique within a module.
The compiler can implement tabling only when generating C code. When compiling a predicate that has a pragma memo
specified for it in a non-C grade, it necessarily ignores the pragma, but normally it prints a warning about this fact. The compiler now supports a new attribute, disable_warning_if_ignored
, that suppresses such warnings for a pragma memo
if included in the pragma’s attribute list, like this:
:- pragma memo(predname/arity, [disable_warning_if_ignored])]).
A pragma foreign_proc
declaration can now include an attribute may_not_export_body
that prevents its body (i.e. the foreign code) from being duplicated outside of the target file for that module by intermodule optimization. This is useful when the foreign code refers to types, functions, etc. that should be kept local to the target file of that module. Unlike the may_not_duplicate
attribute, may_not_export_body
does not prevent inlining of the foreign procedure into other procedures in the same module.
Many pragmas contain a name/arity pair for specifying the predicate or function they apply to; an example is
:- pragma inline(init/1).
If the module in which this pragma occurs contains both a function init/1
and a predicate init/1
, then this pragma is ambiguous. Traditionally, the Mercury compiler applied such ambiguous pragma to both the function and the predicate. The programmers who wished the pragma to apply to only one of them had to rename the other.
Now, pragmas that take a name/arity pair can specify whether they are intended to apply to a function or to a predicate by putting a func()
or pred()
wrapper around the name/arity pair, like this:
:- pragma inline(func(init/1)). % applies ONLY to func init/1.
:- pragma inline(pred(init/1)). % applies ONLY to pred init/1.
This new syntax applies to all of the following kinds of pragmas:
check_termination
consider_used
does_not_terminate
fact_table
inline
loop_check
memo
minimal_model
mode_check_clauses
no_determinism_warning
no_inline
obsolete
promise_equivalent_clauses
promise_pure
promise_semipure
require_tail_recursion
terminates
type_spec
If a command line first enables an optimization (say opt1
), and then sets the optimization level to N
with -O<N>
, then the compiler will now keep opt1
enabled even if opt1
is not normally enabled at optimization level N
.
Due to a bug fix, the --warn-unused-imports
option is now stricter in warning about modules that are imported in the interface section but are not used in the interface section.
We have fixed parsing of reverse implication goals (A <= B).
By default, the compiler now checks some aspects of a module semantics when generating the .int and .int2 interface files for that module. (For example, it generates error messages for references to undefined types, insts and modes.) This new behavior can be switched off for now with the new option --no-halt-at-invalid-interface
. This new option replaces the old --no-print-errors-warnings-when-generating-interface
option, but once any problems caused by the new approach have been ironed out, we intend to delete the --halt-at-invalid-interface
option as well.
In an earlier release, we extended the syntax of :- inst
declarations to allow programmers to specify which type constructor’s values the inst is meant for. At that time, these functioned only as documentation, but the compiler now reports error messages for situations in which an inst that was declared to be intended for values of one type constructor is applied to values of another type constructor.
The new option --output-stdlib-grades
outputs the grades in which the Mercury standard library is available with this compiler.
By default, the compiler now warns if the module being compiled has a name that shadows that of Mercury standard library module. The warning can be disabled using the new option --no-warn-stdlib-shadowing
.
The new options --output-java-class-dir
and --output-java-class-directory
are now supported as synonyms for --output-class-dir
.
The new option --halt-at-warn-make-interface
causes the compiler to treat all warnings as if they were errors when generating interface files.
The new option --halt-at-warn-make-opt
causes the compiler to treat all warnings as if they were errors when generating optimization files.
The new option --warn-potentially-ambiguous-pragma
causes the compiler to generate a warning for all pragmas that include a name/arity pair, but lack a func()
or pred()
wrapper around it to indicate whether they are intended to apply to a function or to a predicate.
We have ported Mercury to Linux AArch64 (ARM64) systems.
The tools/configure_mingw_cross
script has been replaced by tools/configure_cross
. It now supports aarch64-linux-gnu and aarch64-linux-musl as targets (i.e. Linux on aarch64 with GNU or musl C libraries).
The list
command may now call an external command to print source listings; the command is set using list_cmd
. For example, the command could produce syntax highlighted source listings.
We have removed support for browsing terms as XML (browse --xml
) as it was unmaintained and did not work any more. The browse --web
command provides an alternative method for interactively exploring a term.
For news about earlier versions, see the HISTORY file.