The predicates read_term/3
, read_term/4
, read_term_with_op_table/4
, read_term_with_op_table/5
have been removed from the term_io
module of the Mercury standard library.
The io
module is being reorganized. Some predicates have been marked as obsolete, while other predicates that had been marked as obsolete before the release of Mercury 22.01 have been removed.
The old random number generator in the random
module has been removed.
The system of operator priorities in the ops
module has been inverted. Previously, given two operators of different priorities, the one that bound more tightly was the one with the lower numerical priority. Now, operators with higher numerical priorities bind more tightly. There are other changes as well, such as priorities no longer being interchangeable with other integers, some types and function symbols being renamed, and an updated op_table
type class with a somewhat different list of methods.
The old contents of the ops
module is still available as extras/old_library_modules/old_ops
.
The mercury_term_parser
module now expects the operator table to be specified using the updated op_table
type class in the new ops
module.
The old contents of the mercury_term_parser
module is still available as extras/old_library_modules/old_mercury_term_parser
.
The sparse_bitset
and fat_sparse_bitset
modules now require the items in those sets to be instances of the uenum
typeclass, not the enum
typeclass.
The digraph_key
type in the digraph
module is now an instance of the uenum
typeclass, not the enum
typeclass.
The character sequences <<u
and >>u
are now recognized as single tokens. (They are the names of new versions of the left and right shift operators that expect the shift amount to be specified by an unsigned integer; previously, shift amounts were always specified by signed integers.) This means that existing code in which a <<
or >>
operator was followed immediately, without an intervening space, by a u
character, will now be parsed differently.
The compiler no longer accepts :
as the module name separator in backquoted operators. (Mercury switched to using .
as the module name separator around 2003.)
array
moduleThe following predicates have been removed:
pred random_permutation/4
(replacement: random.shuffle_array/4
or random.shuffle_array/5
)
pred sort_fix_2014/0
(no replacement needed)
The following function has been marked obsolete:
array_to_doc/1
benchmarking
moduleThe following predicates have been added:
report_stats/3
report_stats/4
report_standard_stats/2
report_standard_stats/3
report_full_memory_stats/2
report_full_memory_stats/3
report_tabling_statistics/2
report_tabling_statistics/3
The following predicates have been marked obsolete:
report_stats/0
report_full_memory_stats/0
bitmap
moduleThe following predicates have been added:
read_bitmap/6
read_bitmap/7
read_bitmap_range/8
read_bitmap_range/9
write_bitmap/3
write_bitmap/4
write_bitmap_range/5
write_bitmap_range/6
builtin
moduleThe following obsolete predicate and function have been removed:
promise_only_solution/1
promise_only_solution_io/4
char
moduleThe following type has had its typeclass memberships changed:
character
is now an instance of the new uenum
typeclass.The following predicate and functions have been added:
to_uint/1
from_uint/2
det_from_uint/1
The following function has been marked obsolete:
char_to_doc/1
cord
moduleThe following predicates have been added:
foldr2/6
foldr3/8
head/2
is_singleton/2
counter
moduleThe following type has been added:
ucounter/0
The following predicate and function have been added:
uinit/1
uinit/2
uallocate/1
diet
moduleThe following obsolete predicate has been removed:
empty/1
digraph
moduleThe following type has had its typeclass memberships changed:
digraph_key(T)
type is now an instance of the uenum
typeclass, and is no longer an instance of the enum
typeclass.enum
moduleThe following typeclass has been added:
uenum/1
The following function has been added:
det_from_uint/1
fat_sparse_bitset
moduleThe following type has had its typeclass memberships changed:
fat_sparse_bitset(T)
type now requires T
to be an instance of the uenum
typeclass, replacing the earlier requirement that it be a member of the enum
typeclass.The following obsolete predicate has been removed:
empty/1
float
moduleThe following function has been marked obsolete:
float_to_doc/1
hash_table
moduleThe following predicate has been added:
lookup/3
The following obsolete predicates have been removed:
char_hash/2
float_hash/2
generic_hash/2
int_hash/2
string_hash/2
uint_hash/2
int
moduleThe following type has had its typeclass memberships changed:
int
is now an instance of the new uenum
typeclass.The following predicates and functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
ubits_per_int/0
ubits_per_int/1
The following function has been marked obsolete:
int_to_doc/1
int8
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
int8_to_doc/1
int16
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
int16_to_doc/1
int32
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
int32_to_doc/1
int64
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
int64_to_doc/1
io
moduleThe following predicates have been added:
make_io_error_from_system_error/5
make_io_error_from_windows_error/5
get_system_error/2
get_errno_error/2
get_windows_error/2
get_exception_object_error/2
get_system_error_name/2
write_binary_string_utf8/3
write_binary_string_utf8/4
The following obsolete predicates have been removed:
see/3
(replacement: prolog.see/3
)see_binary/3
(replacement: prolog.see_binary/3
)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 predicates have been marked obsolete:
read_bitmap/6
(replacement: bitmap.read_bitmap/6
)read_bitmap/7
(replacement: bitmap.read_bitmap/7
)read_bitmap/8
(replacement: bitmap.read_bitmap_range/8
)read_bitmap/9
(replacement: bitmap.read_bitmap_range/9
)write_bitmap/3
(replacement: bitmap.write_bitmap/3
)write_bitmap/4
(replacement: bitmap.write_bitmap/4
)write_bitmap/5
(replacement: bitmap.write_bitmap_range/5
)pred write_bitmap/6
(replacement: bitmap.write_bitmap_range/6
)
report_stats/3
(replacement: benchmarking.report_stats/3
)report_stats/4
(replacement: benchmarking.report_stats/4
)report_standard_stats/2
(replacement: benchmarking.report_standard_stats/2
)report_standard_stats/3
(replacement: benchmarking.report_standard_stats/3
)report_full_memory_stats/2
(replacement: benchmarking.report_full_memory_stats/2
)report_full_memory_stats/3
(replacement: benchmarking.report_full_memory_stats/3
)report_tabling_statistics/2
(replacement: benchmarking.report_tabling_statistics/2
)pred report_tabling_statistics/3
(replacement: benchmarking.report_tabling_statistics/3
)
remove_file/4
(replacement: io.file.remove_file/4
)remove_file_recursively/4
(replacement: io.file.remove_file_recursively/4
)rename_file/5
(replacement: io.file.rename_file/5
)have_symlinks/0
(replacement: io.file.have_symlinks/0
)make_symlink/5
(replacement: io.file.make_symlink/5
)read_symlink/4
(replacement: io.file.read_symlink/4
)check_file_accessibility/5
(replacement: io.file.check_file_accessibility/5
)file_type/5
(replacement: io.file.file_type/5
)file_modification_time/4
(replacement: io.file.file_modification_time/4
)make_temp_file/3
(replacement: io.file.make_temp_file/3
)make_temp_file/6
(replacement: io.file.make_temp_file/6
)make_temp_directory/3
(replacement: io.file.make_temp_directory/3
)make_temp_directory/6
(replacement: io.file.make_temp_directory/6
)have_make_temp_directory/0
(replacement: io.file.have_make_temp_directory/0
)pred get_temp_directory/3
(replacement: io.file.get_temp_directory/3
)
get_environment_var/4
(replacement: io.environment.get_environment_var/4
)set_environment_var/5
(replacement: io.environment.set_environment_var/5
)set_environment_var/4
(replacement: io.environment.set_environment_var/4
)have_set_environment_var/0
(replacement: io.environment.have_set_environment_var/0
)pred get_environment_var_map/3
(replacement: io.environment.get_environment_var_map/3
)
call_system/4
(replacement: io.call_system.call_system/4
)pred call_system_return_signal/4
(replacement: io.call_system.call_system_return_signal/4
)
get_globals/3
(replacement: a mutable)set_globals/3
(replacement: a mutable)pred update_globals/3
(replacement: a mutable)
input_stream_foldl/5
(replacement: stream.input_stream_fold/6
)input_stream_fold/6
(replacement: stream.input_stream_fold/6
)input_stream_foldl_io/4
(replacement: stream.input_stream_fold_state/5
)input_stream_foldl_io/5
(replacement: stream.input_stream_fold_state/5
)input_stream_foldl2_io/5
(replacement: stream.input_stream_foldl_state/6
)input_stream_foldl2_io/6
(replacement: stream.input_stream_fold_state/6
)input_stream_foldl2_io_maybe_stop/5
(replacement: stream.input_stream_fold2_state_maybe_stop/6
)binary_input_stream_foldl/5
) (replacement: stream.input_stream_fold/6
)binary_input_stream_foldl/6
) (replacement: stream.input_stream_fold/6
)binary_input_stream_foldl_io/4
(replacement: stream.input_stream_fold_state/5
)binary_input_stream_foldl2_io/5
(replacement: stream.input_stream_fold2_state/6
)binary_input_stream_foldl2_io/6
(replacement: stream.input_stream_fold2_state/6
)binary_input_stream_foldl2_io_maybe_stop/5
(replacement: stream.input_stream_fold2_state_maybe_stop/6
)pred binary_input_stream_foldl2_io_maybe_stop/6
(replacement: stream.input_stream_fold2_state_maybe_stop/6
)
io.call_system
moduleThis new module has these predicates and functions:
call_system/4
call_system_return_signal/4
decode_system_command_exit_code/1
io.environment
moduleThis new module has these predicates:
get_environment_var/4
set_environment_var/5
set_environment_var/4
have_set_environment_var/0
get_environment_var_map/3
io.file
moduleThis new module has these predicates:
remove_file/4
remove_file_recursively/4
rename_file/5
have_symlinks/0
make_symlink/5
read_symlink/4
check_file_accessibility/5
file_type/5
file_modification_time/4
make_temp_file/3
make_temp_file/6
make_temp_directory/3
make_temp_directory/6
have_make_temp_directory/0
get_temp_directory/3
list
moduleThe following predicates and functions have been added:
chunk_foldl/5
chunk_foldl2/7
chunk_foldl3/9
chunk_foldl4/11
gap_foldl/5
head/2
tail/2
det_head/2
det_tail/2
inst_preserving_condense/1
intersperse/3
intersperse_list/3
intersperse_list_last/4
is_singleton/2
last_gap_foldl/6
take_while_not/2
take_while_not/3
take_while_not/4
The following function has been marked obsolete:
list_to_doc/1
one_or_more
moduleThe following function has been marked obsolete:
one_or_more_to_doc/1
map
moduleThe following predicate has been added:
sorted_keys_match/2
ops
moduleThe representation of operator priorities has been changed. Priorities used to be represented as signed integers between 0 and 1200, with higher numbers representing operators that bind less tightly. Priorities are now represented using unsigned integers between 0u and 1500u, with higher numbers representing operators that bind more tightly. To guard against priorities being unintentionally confused with other kinds of numbers, they are now wrapped in the prio
function symbol.
The representation of the set of operators that a string may represent has been changed. Operator tables used to map each operator string (such as “-”) to a list of operator descriptions, each of which could be infix, binary prefix, prefix or postfix. This allowed a table entry to declare an operator string to be e.g. an infix operator using two separate entries, with different priorities. Operator tables now map each operator string to a structure which has
Besides making some nonsensical entries that could exist in old op tables unrepresentable, the new op table also allows users of operator information to test more simply and quickly whether an operator string represents e.g. a prefix operator.
The assoc
type has been renamed to arg_prio_gt_or_ge
, which reflects its semantics. Its function symbols x
and y
have been renamed to arg_gt
and arg_ge
respectively.
The list of methods in the op_table
type class has been changed.
The method max_priority/1
has been replaced by the method loosest_op_priority/1
.
The method lookup_op/2
has been renamed to is_op/2
.
The new method universal_priority/1
has been added. It is intended to replace uses of max_priority + 1
to denote a context that accept terms using any operator, regardless of its priority.
The new method tightest_op_priority/1
has been added. It is intended to replace uses of the integer constant 0
as a priority.
The new method comma_priority/1
has been added. It is intended to denote the priority of the comma character, which separates term arguments, when used as an operator.
The argument types of the lookup_op_infos/2
method have been changed.
The following predicates and functions have been added:
decrement_priority/1
increment_priority/1
mercury_op_table_arg_priority/0
mercury_op_table_comma_priority/0
mercury_op_table_loosest_op_priority/0
mercury_op_table_tightest_op_priority/0
mercury_op_table_universal_priority/0
mercury_op_table_binary_prefix_op/5
mercury_op_table_infix_op/5
mercury_op_table_lookup_operator_term/3
mercury_op_table_postfix_op/4
mercury_op_table_prefix_op/4
mercury_op_table_search_binary_prefix_op/4
mercury_op_table_search_infix_op/4
mercury_op_table_search_op/1
mercury_op_table_search_op_infos/3
mercury_op_table_search_postfix_op/3
mercury_op_table_search_prefix_op/3
min_priority_for_arg/2
priority_ge/2
priority_gt/2
priority_le/2
priority_lt/2
The following predicates have been renamed:
mercury_op_table_prefix_op/5' to
op_infos_prefix_op/5`mercury_op_table_binary_prefix_op/5' to
op_infos_binary_prefix_op/5`mercury_op_table_infix_op/5' to
op_infos_infix_op/5`mercury_op_table_postfix_op/5' to
op_infos_postfix_op/5`pretty_printer
moduleThe following predicates and functions have been added:
array_to_doc/1
char_to_doc/1
float_to_doc/1
get_formatter_map_entry_types/1
int_to_doc/1
int8_to_doc/1
int16_to_doc/1
int32_to_doc/1
int64_to_doc/1
list_to_doc/1
one_or_more_to_doc/1
string_to_doc/1
tree234_to_doc/1
uint_to_doc/1
uint8_to_doc/1
uint16_to_doc/1
uint32_to_doc/1
uint64_to_doc/1
version_array_to_doc/1
write_doc_formatted/3
write_doc_formatted/4
ra_list
modulerandom
moduleThe old random number generator has been removed. It has been replaced by the new type class random number generation framework defined in this module. As a result, the following predicates have been removed:
init/2
random/3
random/5
randmax/3
randcount/3
permutation/4
(replacement: random.shuffle_list/4
or random.shuffle_list/5
)set
moduleThe following obsolete predicates and function have been removed:
empty/1
non_empty/1
set/1
set_bbbtree
moduleThe following obsolete predicates have been removed:
empty/1
non_empty/1
set_ctree234
moduleThe following obsolete predicates have been removed:
empty/1
non_empty/1
set_ordlist
moduleThe following obsolete predicates have been removed:
empty/1
non_empty/1
set_tree234
moduleThe following obsolete predicates have been removed:
empty/1
non_empty/1
set_unordlist
moduleThe following obsolete predicates have been removed:
empty/1
non_empty/1
sparse_bitset
moduleThe following type has had its typeclass memberships changed:
sparse_bitset(T)
type now requires T
to be an instance of the uenum
typeclass, replacing the earlier requirement that it be a member of the enum
typeclass.The following obsolete predicates has been removed:
empty/1
string
moduleThe following predicate has been added:
contains_match/2
The following obsolete modes have been removed from the following predicates:
to_char_list(uo, in)
to_rev_char_list(in, out)
append(out, out, in)
prefix(in, out)
suffix(in, out)
The following function has been marked obsolete:
string_to_doc/1
term
moduleThe following type has had its typeclass memberships changed:
var/1
is now an instance of the new uenum
typeclass.The following predicates have been marked obsolete:
pred generic_term/1
(replacement: with_type
annotations on expressions)
decimal_term_to_int/2
(replacement: term_int.decimal_term_to_int/2
)term_to_int/2
(replacement: term_int.term_to_int/2
)term_to_int8/2
(replacement: term_int.term_to_int8/2
)term_to_int16/2
(replacement: term_int.term_to_int16/2
)term_to_int32/2
(replacement: term_int.term_to_in32t/2
)term_to_int64/2
(replacement: term_int.term_to_int64/2
)term_to_uint/2
(replacement: term_int.term_to_uint/2
)term_to_uint8/2
(replacement: term_int.term_to_uint8/2
)term_to_uint16/2
(replacement: term_int.term_to_uint16/2
)term_to_uint32/2
(replacement: term_int.term_to_uin32t/2
)term_to_uint64/2
(replacement: term_int.term_to_uint64/2
)int_to_decimal_term/2
(replacement: term_int.int_to_decimal_term/2
)int8_to_decimal_term/2
(replacement: term_int.int8_to_decimal_term/2
)int16_to_decimal_term/2
(replacement: term_int.int16_to_decimal_term/2
)int32_to_decimal_term/2
(replacement: term_int.int32_to_decimal_term/2
)int64_to_decimal_term/2
(replacement: term_int.int64_to_decimal_term/2
)uint_to_decimal_term/2
(replacement: term_int.uint_to_decimal_term/2
)uint8_to_decimal_term/2
(replacement: term_int.uint8_to_decimal_term/2
)uint16_to_decimal_term/2
(replacement: term_int.uint16_to_decimal_term/2
)uint32_to_decimal_term/2
(replacement: term_int.uint32_to_decimal_term/2
)func uint64_to_decimal_term/2
(replacement: term_int.uint64_to_decimal_term/2
)
occurs/3
(replacement: term_subst.var_occurs_in_subst_term/2
)occurs_list/3
(replacement: term_subst.var_occurs_in_subst_terms/2
)is_ground/1
(replacement: term_subst.term_is_ground/1
)is_ground_in_bindings/2
(replacement: term_subst.term_is_ground_in_bindings/2
)rename_var_in_term/4
(replacement: term_subst.rename_var_in_term/4
)rename_var_in_terms/4
(replacement: term_subst.rename_var_in_terms/4
)apply_renaming_in_var/3
(replacement: term_subst.apply_renaming_in_var/3
)apply_renaming_in_vars/3
(replacement: term_subst.apply_renaming_in_vars/3
)apply_renaming_in_term/3
(replacement: term_subst.apply_renaming_in_term/3
)apply_renaming_in_terms/3
(replacement: term_subst.apply_renaming_in_terms/3
)substitute_var_in_term/4
(replacement: term_subst.substitute_var_in_term/4
)substitute_var_in_terms/4
(replacement: term_subst.substitute_var_in_terms/4
)substitute_corresponding_in_term/3
(replacement: term_subst.substitute_corresponding_in_term/3
)substitute_corresponding_in_terms/3
(replacement: term_subst.substitute_corresponding_in_terms/3
)apply_substitution_in_term/3
(replacement: term_subst.apply_substitution_in_term/3
)apply_substitution_in_terms/3
(replacement: term_subst.apply_substitution_in_terms/3
)apply_rec_substitution_in_term/3
(replacement: term_subst.apply_rec_substitution_in_term/3
)apply_rec_substitution_in_terms/3
(replacement: term_subst.apply_rec_substitution_in_terms/3
)term_list_to_var_list/2
(replacement: term_subst.term_list_to_var_list/1
)term_list_to_var_list/2
(replacement: term_subst.term_list_to_var_list/2
)var_list_to_term_list/2
(replacement: term_subst.var_list_to_term_list/1
)pred var_list_to_term_list/2
(replacement: term_subst.var_list_to_term_list/2
)
unify_term/4
(replacement: term_unify.unify_terms/4
)unify_term_list/4
(replacement: term_unify.unify_term_lists/4
)unify_term_dont_bind/5
(replacement: term_unify.unify_terms_dont_bind/5
)unify_term_list_dont_bind/5
(replacement: term_unify.unify_term_lists_dont_bind/5
)pred list_subsumes/3
(replacement: term_unify.first_term_list_subsumes_second/3
)
vars/1
(replacement: term_vars.vars_in_term/1
)vars/2
(replacement: term_vars.vars_in_term/2
)vars_2/2
(replacement: term_vars.vars_in_term_acc/3
)vars_2/3
(replacement: term_vars.vars_in_term_acc/3
)vars_list/1
(replacement: term_vars.vars_in_terms/1
)vars_list/2
(replacement: term_vars.vars_in_terms/2
)contains_var/2
(replacement: term_vars.term_contains_var/2
)pred contains_var_list/2
(replacement: term_vars.terms_contain_var/2
)
context_init/2
(replacement: term_context.context_init/2
)context_init/3
(replacement: term_context.context_init/2
)context_init/0
(replacement: term_context.dummy_context/0
)context_init/1
(replacement: term_context.dummy_context/0
)dummy_context_init/0
(replacement: term_context.dummy_context/0
)is_dummy_context/1
(replacement: term_context.is_dummy_context/1
)context_file/1
(replacement: term_context.context_file/1
)context_file/2
(replacement: term_context.context_file/1
)context_line/1
(replacement: term_context.context_line/1
)pred context_line/2
(replacement: term_context.context_line/1
)
term_context
moduleterm_context
type, and contains predicates and functions that operate on that type.term_int
moduleterm_io
moduleThe following predicates have been removed:
read_term/3
(replacement: mercury_term_parser.read_term/3
)read_term/4
(replacement: mercury_term_parser.read_term/4
)read_term_with_op_table/4
(replacement: mercury_term_parser.read_term_with_op_table/4
)read_term_with_op_table/5
(replacement: mercury_term_parser.read_term_with_op_table/5
)term_subst
moduleterm_unify
moduleterm_vars
moduletree234
moduleThe following predicate has been added:
sorted_keys_match/2
The following function has been marked obsolete:
tree234_to_doc/1
tree_bitset
moduleThe following obsolete predicates has been removed:
empty/1
uint
moduleThe following type has had its typeclass memberships changed:
uint
is now an instance of the new uenum
typeclass.The following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
ubits_per_uint/0
The following function has been marked obsolete:
uint_to_doc/1
uint8
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
uint8_to_doc/1
uint16
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
uint16_to_doc/1
uint32
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
uint32_to_doc/1
uint64
moduleThe following functions have been added:
<<u/2
>>u/2
unchecked_left_ushift/2
unchecked_right_ushift/2
The following function has been marked obsolete:
uint64_to_doc/1
version_array
moduleThe following predicate has been added:
lookup/3
The following function has been marked obsolete:
version_array_to_doc/1
version_hash_table
moduleThe following predicate has been added:
lookup/3
The following obsolete predicates have been removed:
char_hash/2
float_hash/2
generic_hash/2
int_hash/2
string_hash/2
uint_hash/2
The new pragma format_call
can now be used to ask the compiler to perform the same checks on calls to a named predicate or function as the compiler performs on calls to string.format
, io.format
and stream.string_writer.format
. These checks test whether the format string matches the provided list of values.
You can now disable another kind of warning with a disable_warning
scope. Code such as
disable_warning [unknown_format_calls] (
...
)
will disable warnings about any calls in the scope to string.format
, io.format
and/or stream.string_writer.format
for which the compiler cannot tell whether there are any mismatches between the format string and the supplied values, even if the module is compiled with --warn-unknown-format-calls
.
We have fixed a bug where --warn-unused-imports
did not warn about unused modules that are also imported by an ancestor of the current module.
We have added a new option --warn-ambiguous-pragmas
that tells the compiler to generate warnings for pragmas that specify a name/arity pair, when there is both a predicate and a function with that name and arity, and the pragma does not specify which one it is for.
We have added a new option --reverse-error-order
that tells the compiler to output error messages for higher line numbers before error messages for lower line numbers.
We have added a new option --show-local-call-tree
that tells the compiler to output a representation of the call tree of the predicates and functions of the module as ordered by a depth-first left-to-right traversal of the bodies of the first (i.e. main) procedures of those predicates and functions. This can suggest a good order for the positions of those predicates and functions in the source code.
The deprecated option --trail-segments
has been deleted and the grade component trseg
is no longer accepted as a synonym for tr
.
--javac-flags
is now accepted as a synonym for --java-flags
. Similarly --javac-flag
is now accepted as a synonym for --java-flags
.
The new options --java-runtime-flags
and --java-runtime-flags
can be used to set flags for the Java interpreter in the launcher shell scripts or batch files generated by the compiler when creating executables in the java
grade.
On MacOS systems, the configure script now uses the value of the MACOSX_DEPLOYMENT_TARGET
environment variable as the default value for the deployment target, if set.
dump
command has a new option: dump -p Var
will dump the value of the given variable in a prettyprinted form.tools/configure_cross
to support cross-compiling using clang.old_term_parser
library.This is a bug-fix release.
We have fixed a bug that was causing invalid fact table file names to be written to dependency files.
We have fixed a bug with the MLDS backend that was causing crashes with certain switches on strings.
We have fixed a bug that was causing some transitive intermodule optimization interfaces to be silently ignored.
We have fixed a bug where termination analysis could cause a compiler abort when invoked on some rarely-occurring predicate structures.
This is a bug-fix release.
We have fixed and clarified the behaviour of the following string
module predicates when called on a string containing ill-formed code unit sequences:
all_match/2
index_next_repl/5
unsafe_index_next_repl/5
prev_index_repl/5
unsafe_prev_index_repl/5
We have fixed a bug in the getopt
and getopt_io
modules where negating a maybe_string
option would set its option table entry to an incorrect value.
We have fixed an issue where flags specific to GCC were being passed to MSVC when building Mercury using MSVC.
This is a bug-fix release.
asm_fast
grades with GCC versions 11 and 12 on x86_64 systems.This is a bug-fix release.
[Mantis bug #558]. We have fixed a bug that was causing some of the manual pages to sometimes build incorrectly.
[Mantis bug #560]. We have disabled the use of the asm_fast*
grades on AArch64 when using GCC 9+ due to incompatibilities with position-independent code.
We have fixed a bug that was causing assertion failures or segmentation violations in the Mercury runtime on AArch64 systems with versions of GCC before 10.
[Github issue #102]. We have disabled the use of the GCC option -Warray-bounds
for GCC version 12 and onwards. This is due to GCC emitting spurious warnings when that option is enabled. (The use of that option was already disabled for GCC versions 9-11.)
This is a bug-fix release.
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 pragmas 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.