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/1benchmarking moduleThe following predicates have been added:
report_stats/3report_stats/4report_standard_stats/2report_standard_stats/3report_full_memory_stats/2report_full_memory_stats/3report_tabling_statistics/2report_tabling_statistics/3The following predicates have been marked obsolete:
report_stats/0report_full_memory_stats/0bitmap moduleThe following predicates have been added:
read_bitmap/6read_bitmap/7read_bitmap_range/8read_bitmap_range/9write_bitmap/3write_bitmap/4write_bitmap_range/5write_bitmap_range/6builtin moduleThe following obsolete predicate and function have been removed:
promise_only_solution/1promise_only_solution_io/4char 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/1from_uint/2det_from_uint/1The following function has been marked obsolete:
char_to_doc/1cord moduleThe following predicates have been added:
foldr2/6foldr3/8head/2is_singleton/2counter moduleThe following type has been added:
ucounter/0The following predicate and function have been added:
uinit/1uinit/2uallocate/1diet moduleThe following obsolete predicate has been removed:
empty/1digraph 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/1The following function has been added:
det_from_uint/1fat_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/1float moduleThe following function has been marked obsolete:
float_to_doc/1hash_table moduleThe following predicate has been added:
lookup/3The following obsolete predicates have been removed:
char_hash/2float_hash/2generic_hash/2int_hash/2string_hash/2uint_hash/2int 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/2unchecked_left_ushift/2unchecked_right_ushift/2ubits_per_int/0ubits_per_int/1The following function has been marked obsolete:
int_to_doc/1int8 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
int8_to_doc/1int16 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
int16_to_doc/1int32 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
int32_to_doc/1int64 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
int64_to_doc/1io moduleThe following predicates have been added:
make_io_error_from_system_error/5make_io_error_from_windows_error/5get_system_error/2get_errno_error/2get_windows_error/2get_exception_object_error/2get_system_error_name/2write_binary_string_utf8/3write_binary_string_utf8/4The 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/4call_system_return_signal/4decode_system_command_exit_code/1io.environment moduleThis new module has these predicates:
get_environment_var/4set_environment_var/5set_environment_var/4have_set_environment_var/0get_environment_var_map/3io.file moduleThis new module has these predicates:
remove_file/4remove_file_recursively/4rename_file/5have_symlinks/0make_symlink/5read_symlink/4check_file_accessibility/5file_type/5file_modification_time/4make_temp_file/3make_temp_file/6make_temp_directory/3make_temp_directory/6have_make_temp_directory/0get_temp_directory/3list moduleThe following predicates and functions have been added:
chunk_foldl/5chunk_foldl2/7chunk_foldl3/9chunk_foldl4/11gap_foldl/5head/2tail/2det_head/2det_tail/2inst_preserving_condense/1intersperse/3intersperse_list/3intersperse_list_last/4is_singleton/2last_gap_foldl/6take_while_not/2take_while_not/3take_while_not/4The following function has been marked obsolete:
list_to_doc/1one_or_more moduleThe following function has been marked obsolete:
one_or_more_to_doc/1map moduleThe following predicate has been added:
sorted_keys_match/2ops 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/1increment_priority/1mercury_op_table_arg_priority/0mercury_op_table_comma_priority/0mercury_op_table_loosest_op_priority/0mercury_op_table_tightest_op_priority/0mercury_op_table_universal_priority/0mercury_op_table_binary_prefix_op/5mercury_op_table_infix_op/5mercury_op_table_lookup_operator_term/3mercury_op_table_postfix_op/4mercury_op_table_prefix_op/4mercury_op_table_search_binary_prefix_op/4mercury_op_table_search_infix_op/4mercury_op_table_search_op/1mercury_op_table_search_op_infos/3mercury_op_table_search_postfix_op/3mercury_op_table_search_prefix_op/3min_priority_for_arg/2priority_ge/2priority_gt/2priority_le/2priority_lt/2The following predicates have been renamed:
mercury_op_table_prefix_op/5' toop_infos_prefix_op/5`mercury_op_table_binary_prefix_op/5' toop_infos_binary_prefix_op/5`mercury_op_table_infix_op/5' toop_infos_infix_op/5`mercury_op_table_postfix_op/5' toop_infos_postfix_op/5`pretty_printer moduleThe following predicates and functions have been added:
array_to_doc/1char_to_doc/1float_to_doc/1get_formatter_map_entry_types/1int_to_doc/1int8_to_doc/1int16_to_doc/1int32_to_doc/1int64_to_doc/1list_to_doc/1one_or_more_to_doc/1string_to_doc/1tree234_to_doc/1uint_to_doc/1uint8_to_doc/1uint16_to_doc/1uint32_to_doc/1uint64_to_doc/1version_array_to_doc/1write_doc_formatted/3write_doc_formatted/4ra_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/2random/3random/5randmax/3randcount/3permutation/4 (replacement: random.shuffle_list/4 or random.shuffle_list/5)set moduleThe following obsolete predicates and function have been removed:
empty/1non_empty/1set/1set_bbbtree moduleThe following obsolete predicates have been removed:
empty/1non_empty/1set_ctree234 moduleThe following obsolete predicates have been removed:
empty/1non_empty/1set_ordlist moduleThe following obsolete predicates have been removed:
empty/1non_empty/1set_tree234 moduleThe following obsolete predicates have been removed:
empty/1non_empty/1set_unordlist moduleThe following obsolete predicates have been removed:
empty/1non_empty/1sparse_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/1string moduleThe following predicate has been added:
contains_match/2The 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/1term 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/2The following function has been marked obsolete:
tree234_to_doc/1tree_bitset moduleThe following obsolete predicates has been removed:
empty/1uint 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/2unchecked_left_ushift/2unchecked_right_ushift/2ubits_per_uint/0The following function has been marked obsolete:
uint_to_doc/1uint8 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
uint8_to_doc/1uint16 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
uint16_to_doc/1uint32 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
uint32_to_doc/1uint64 moduleThe following functions have been added:
<<u/2>>u/2unchecked_left_ushift/2unchecked_right_ushift/2The following function has been marked obsolete:
uint64_to_doc/1version_array moduleThe following predicate has been added:
lookup/3The following function has been marked obsolete:
version_array_to_doc/1version_hash_table moduleThe following predicate has been added:
lookup/3The following obsolete predicates have been removed:
char_hash/2float_hash/2generic_hash/2int_hash/2string_hash/2uint_hash/2The 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/2index_next_repl/5unsafe_index_next_repl/5prev_index_repl/5unsafe_prev_index_repl/5We 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_rngarray 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/7array2d 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/2maybe_from_corresponding_lists/3bag 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/2get_bits/2get_byte/2set_bit/4set_bits/4set_byte/4unsafe_get_bit/2unsafe_get_bits/2unsafe_get_byte/2unsafe_set_bit/4unsafe_set_bits/4unsafe_set_byte/4char moduleThe following predicates have been added:
unsafe_base_digit_to_int/3to_utf8_uint8/2to_utf16_uint16/2The 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/6foldl3/8dir moduleThe following predicate has been added:
general_foldl2/8getopt moduleThe following new predicates have been added:
record_arguments/8expand_file_specials/8The following variants of the existing process_options predicate have been added:
process_options_io/6process_options_io/7process_options_track_io/9process_options_userdata/8process_options_userdata_io/10The 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/6process_options/7process_options_track/7All 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/6process_options_se/7process_options_track_se/7Their 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_int8cast_from_int8cast_to_int16cast_from_int16cast_to_int64cast_from_int64integer 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/3read_binary_int8_unboxed/5read_binary_uint8_unboxed/5read_named_file_as_string/4read_named_file_as_lines/4write_line_cc/4The 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/3foldl7/16foldl8/18foldl4_corresponding/11The following obsolete predicate has been removed:
takewhile/4 (replacement: take_while/4)map moduleThe following predicates have been added to this module:
foldl6/14foldl6_values/14foldr6/14maybe moduleThe following predicates have been added to this module:
foldl3_maybe/8foldl4_maybe/10foldl5_maybe/12map_foldl4_maybe/11map_foldl5_maybe/13parser 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/2split_into_lines/1to_uint/2det_to_uint/1base_string_to_uint/3det_base_string_to_uint/2uint_to_hex_string/1uint_to_uc_hex_string/1uint_to_octal_string/1uint64_to_hex_string/1uint64_to_uc_hex_string/1uint64_to_octal_string/1The 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/0set_min_stack_size/3spawn_native/5thread.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/14foldl6_values/14foldr6/14uint16 moduleThe following functions have been added:
from_uint/2det_from_uint/1cast_from_uint/1rotate_left/2rotate_right/2unchecked_rotate_left/2unchecked_rotate_right/2set_bit/2unchecked_set_bit/2clear_bit/2unchecked_clear_bit/2flip_bit/2unchecked_flip_bit/2bit_is_set/2unchecked_bit_is_set/2bit_is_clear/2unchecked_bit_is_clear/2cast_from_uint8/1cast_to_uint8/1uint32 moduleThe following functions have been added:
from_uint/2det_from_uint/1rotate_left/2rotate_right/2unchecked_rotate_left/2unchecked_rotate_right/2set_bit/2unchecked_set_bit/2clear_bit/2unchecked_clear_bit/2flip_bit/2unchecked_flip_bit/2bit_is_set/2unchecked_bit_is_set/2bit_is_clear/2unchecked_bit_is_clear/2cast_from_uint8/1cast_to_uint8/1cast_from_uint16/1cast_to_uint16/1uint64 moduleThe following functions have been added:
cast_from_uint/1rotate_left/2rotate_right/2unchecked_rotate_left/2unchecked_rotate_right/2set_bit/2unchecked_set_bit/2clear_bit/2unchecked_clear_bit/2flip_bit/2unchecked_flip_bit/2bit_is_set/2unchecked_bit_is_set/2bit_is_clear/2unchecked_bit_is_clear/2cast_from_uint8/1cast_to_uint8/1uint8 moduleThe following functions have been added:
from_uint/2det_from_uint/1cast_from_uint/1rotate_left/2rotate_right/2unchecked_rotate_left/2unchecked_rotate_right/2set_bit/2unchecked_set_bit/2clear_bit/2unchecked_clear_bit/2flip_bit/2unchecked_flip_bit/2bit_is_set/2unchecked_bit_is_set/2bit_is_clear/2unchecked_bit_is_clear/2varset 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/2unname_var/3undo_default_names/2The 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_specIf 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.