It has been deprecated since Mercury 20.01.
library/random.m:
Delete the old generator.
library/array.m:
Delete the predicate random_permutation/4.
NEWS:
Announce the above.
tests/hard_coded/string_hash.m:
Update this test to use the new RNG framework.
tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.{m,exp}:
tests/hard_coded/random_simple.{m,exp}:
Delete these tests, they were specific to the old RNG.
extras/curs/samples/nibbles.m:
extras/solver_types/library/any_array.m:
Replace use of the old RNG.
This is work-in-progress, currently only the C# and Java backends
are supported. Support for the C backends will be added separately.
library/random.system_rng.m:
A new submodule containing the system RNG.
library/random.m:
library/library.m:
Include the new submodule.
library/MODULES_UNDOC:
Do not generate documentation for the new submodule.
library/*.m:
Specifically, delete any predicates and functions whose `pragma obsolete'
dates from 2018 or before. Keep the ones that were obsoleted
only this year or last year.
NEWS:
Announce the changes.
tests/debugger/io_tab_goto.m:
tests/debugger/tabled_read.m:
tests/declarative_debugger/io_stream_test.m:
tests/declarative_debugger/tabled_read_decl.m:
tests/declarative_debugger/tabled_read_decl_goto.m:
tests/general/array_test.m:
tests/hard_coded/mutable_init_impure.m:
tests/hard_coded/remove_file.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace references to predicates and functions that this diff deletes
with their suggested replacements.
In several test cases, bring the programming style up to date.
tests/hard_coded/shift_test.{m,exp}:
Most of this test case tested the now-deleted legacy shift operations.
Replace these with tests of their non-legacy versions, including
testing for the expected exceptions.
tests/hard_coded/shift_test.{m,exp}:
Don't pass --no-warn-obsolete when compiling shift_test.m anymore.
library/random.m:
Add predicates shuffle_list/{4,5} and shuffle_array/{4,5}.
library/random.m:
library/random.sfc*.m:
Improve comments.
tests/hard_coded/Mmakefile:
tests/hard_coded/random_shuffle*.{m,exp}:
Test the new predicates.
library/random.m:
Move the new code to the existing random module. Update names and
typeclass methods.
Add adaptors to attach any ground or shared generator to the I/O
state.
library/random.sfc{16,32,64}.m:
Move sfc generators to here. Update for changes to interface.
extras/README:
extras/random/*.m:
Move unused generators to a new directory under extras.
library/uint32.m:
Add cast_from_uint/1.
library/MODULES_DOC:
library/library.m:
Update for the module changes.
tests/hard_coded/*:
Rename test cases to correspond with the library module name.
Test the I/O adaptor.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
library/random.m:
As above, update documentation comments style, use state variables as
part of documentation comments and remove obvious module qualifications.
Specifically, we now do three new checks:
BAD_DETISM: We now generate error messages for predicate declarations
that specify a determinism without also specifying argument modes.
BAD_PREDMODE: We now generate error messages for standalone mode declarations
for predicates whose predicate declaration includes modes for the arguments.
BAD_MODE_SECTION: We now generate error messages for standalone mode
declarations that are not in the same section as the predicate's (or
function's) type declaration.
compiler/hlds_pred.m:
Add a slot to the pred_sub_info. If the predicate is explicitly defined by
the user in the current module, this contains the id of the section that
contains its predicate declaration (for the BAD_MODE_SECTION check)
and whether that predicate declaration also had modes for the arguments
(for the BAD_PREDMODE check).
compiler/add_pred.m:
When adding adding new predicate declarations, perform the BAD_DETISM
check, and record the info needed for the BAD_PREDMODE and BAD_MODE_SECTION
checks.
When adding adding new mode declarations, perform the BAD_PREDMODE
and BAD_MODE_SECTION checks.
compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/dep_par_conj.m:
compiler/higher_order.m:
compiler/make_hlds_passes.m:
compiler/table_gen.m:
compiler/unused_args.m:
Conform to the changes above.
mdbcomp/builtin_modules.m:
Add a utility predicate for use by new code in add_pred.m.
compiler/comp_unit_interface.m:
compiler/goal_util.m:
compiler/prog_rename.m:
compiler/quantification.m:
deep_profiler/program_representation_utils.m:
library/calendar.m:
library/mutvar.m:
library/pretty_printer.m:
library/random.m:
library/set_ctree234.m:
library/solutions.m:
library/stream.string_writer.m:
profiler/globals.m:
tests/accumulator/nonrec.m:
tests/accumulator/out_to_in.m:
tests/declarative_debugging/library_forwarding.m:
tests/dppd/applast_impl.m:
tests/dppd/grammar_impl.m:
tests/dppd/regexp.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/ho_func_default_inst.m:
tests/recompilation/unchanged_pred_nr_2.m.1:
tests/recompilation/unchanged_pred_nr_2.m.2:
tests/valid/det_switch.m:
tests/valid/inlining_bug.m:
Delete determinism declarations from predicate and function declarations
that have no argument mode information, since the BAD_DETISM check
now makes these errors.
tests/valid/two_pragma_c_codes.m:
Move some mode declarations to the right section, since the
BAD_MODE_SECTION check now generates an error for the old code.
tests/invalid/typeclass_bad_method_mode.{m,err_exp}:
New test case to test for the BAD_PREDMODE check.
tests/invalid/mode_decl_in_wrong_section.{m,err_exp}:
New test case to test for the BAD_MODE_SECTION check.
tests/invalid/bad_detism.err_exp:
Add an expected output for this old, but never enabled test case,
which tests for new check BAD_DETISM.
tests/invalid/Mmakefile:
Enable the new test cases.
tests/invalid/typeclass_dup_method_mode.m:
This test case used to have two bugs. One is now by itself in the new
typeclass_bad_method_mode.m test case, so modify it to contain only
the other (indistinguishable modes).
tests/invalid/func_errors.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/undef_lambda_mode.err_exp:
tests/invalid/undef_type_mode_qual.err_exp:
Expect an extra error message from the BAD_DETISM check.
Branches: main
Change the order of predicate arguments in the array module to make them
more conducive to the use of state variable notation.
library/array.m:
As above.
Group clauses for functions with those of the corresponding
predicate.
library/svarray.m:
library/hash_table.m:
library/io.m:
library/random.m:
compiler/lambda.m:
deep_profiler/array_util.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/dense_bitset.m:
deep_profiler/measurements.m:
deep_profiler/profile.m:
deep_profiler/read_profile.m:
deep_profiler/startup.m:
tests/general/array_test.m:
tests/general/mode_inf.m:
tests/hard_coded/array_test2.m:
tests/hard_coded/lp.m:
tests/hard_coded/reuse_array.m:
Conform to the above change and remove dependencies
on the svarray module.
tests/general/set_test.m:
Replace calls to set_bbbtree.size/2 with calls to
set_bbbtree.count/2.
NEWS:
Announce the above change.
Estimated hours taken: 0.2
Branches: main, release
library/*.m:
Improve the library reference manual by formatting the beginning of
library modules consistently.
library/integer.m:
Fix some bad indentation.
Estimated hours taken: 1
Branches: main
library/*.m:
Replace __ with . as the module qualifier everywhere.
tests/hard_coded/test_injection.exp:
Replace __ with . as the module qualifier in expected exceptions.
Estimated hours taken: 4
Branches: main
library/*.m:
Convert to four-space indentation most of the library modules that
weren't already indented that way. Use predmode syntax where possible.
In some modules, shorten long lines by deleting module name prefixes.
Fix departures from our coding standards.
In some modules, simplify code, mostly using field names and/or state
variables.
There are no changes in algorithms, except for neg_list in integer.m.
Estimated hours taken: 3.5
Branches: main
Make the positioning of descriptive comments conform
to the coding standard for the following library modules.
Convert preds to predmode syntax where possible.
Make the ordering of related predicates and functions
conform to the coding standard, where the descriptive
comment makes it possible to do that.
Other minor changes are listed below.
library/bimap.m:
Fix capitalisation of a few comments.
library/dir.m:
s/throw an exception/throws an exception/.
library/exception.m:
Fix the comment about the exception_result/1 type.
There is only one type and an inst following the comment.
library/map.m:
Remove the unique modes for map.set/4, map.delete/3 and
map.delete_list/3.
library/rbtree.m:
Remove the unique modes for rbtree.set/4, rbtree.delete/3,
rbtree.remove/4, rbtree.remove_smallest/4 and rbtree.remove_largest/4.
library/tree234.m:
Remove left over unique modes for preds.
library/set.m:
XXX the ordering of procedures in this module is a bit strange.
library/set_bbbtree.m:
library/set_unordlist.m:
Remove various unique modes for set operations like
delete/3. (Some of these were commented out anyway).
library/term_to_xml.m:
Fix a spot where line width exceeded 79 characters.
library/array.m:
library/assoc_list.m:
library/random.m:
library/multi_map.m:
library/pqueue.m:
library/queue.m:
library/bool.m:
library/char.m:
library/construct.m:
library/counter.m:
library/deconstruct.m:
library/eqvclass.m:
library/gc.m:
library/io.m:
library/sparse_bitset.m:
library/stack.m:
library/std_util.m:
library/store.m:
library/string.m:
library/term.m:
library/term_io.m:
library/type_desc.m:
library/varset.m:
As above.
Estimated hours taken: 10
Branches: main
library/*.m:
Bring these modules up to date with our current style guidelines.
Use predmode declarations where appropriate. Use state variable syntax
where appropriate. Reorder arguments where this makes it possible to
to use state variable syntax.
library/io.m:
Export some predicates that are duplicated in term_io.m and/or
parser.m, and give them more expressive names.
library/parser.m:
library/term_io.m:
Delete the now unnecessary copies of those predicates in these modules.
Estimated hours taken: 2
Branches: main
Avoid the use of abstract equivalence types or abstract foreign types in
a couple of places in the standard library where they cause type errors
(for lcc) or warnings (for gcc) in --high-level-code grades for some
test cases.
library/random.m:
Use a no-tag type rather than an abstract equivalence type.
library/time.m:
Fix an old XXX about representing time_t as a int: use a pragma
foreign_type instead. Then wrap this in a no-tag type,
to avoid making time.time_t an abstract foreign_type.
Estimated hours taken: 1.5
Branches: main
library/random.m:
Provide better documentation on how (not) to use the random number
generator in the standard library. Generators of this kind are
very sensitive to the way in which they are used, and if used
in a way not anticipated they can give very poor results.
XXX The standard library really should provide a better quality RNG.
There is still a place for quick and dirty RNGs like this one,
though, provided users are given adequate information about the
pitfalls.
One of the pitfalls to avoid is that you shouldn't use mod (or rem)
to reduce a number down to some desired range, you should use
something like div. We therefore provide a predicate that does
this the prescribed way. We also provide a predicate that is
similar to randmax, but returns the number of distinct random
numbers that can be generated instead of the maximum.
Fix random__permutation to avoid the above pitfall.
Replace some occurrences of is/2 with =/2.
NEWS:
Mention the new predicate.
tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.exp:
tests/hard_coded/random_permutation.m:
A test case for random__permutation. We don't test that the
result is "random", but we at least test that it is a permutation.
tests/hard_coded/random_simple.exp:
tests/hard_coded/random_simple.m:
A simple test that checks for off-by-one errors in random__random/5.
tests/hard_coded/stable_sort.m:
tests/hard_coded/test_bitset.exp:
tests/hard_coded/test_bitset.m:
Fix these tests to avoid the above pitfall. The bitset tester also
needed to be modified so that it doesn't output anything that may
depend on the particular random sequence generated.
Estimated hours taken: 0.4
library/random.m:
Added support for in/out random__supply arguments to
complement the existing mdi/muo modes. This is useful
when a random__supply is a component of a non-(mostly-)
unique object.
Estimated hours taken: 0.75
library/random.m:
Improve efficiency of random__permutation:
- use an array rather than a map
- use `rem' rather than `div'
Estimated hours taken: 2
library/random.m:
Change random__permutation so that it takes
as its first argument a list(T) rather than an int N,
and returns a permutation of that list rather than
a permutation of the integers 0 .. N-1.
tests/tabling/expand*.m:
Change to reflect the new interface to random__permutation.
NEWS:
Document the random__permutation predicate.
Estimated hours taken: 0.1
library/random.m:
Change the coefficients for the linear-congruential generator.
They now assume only 31 bits (unsigned) rather than 32. This
should prevent the defective behaviour reported on the
mercury-users mailing list.
Estimated hours taken: 0.5
library/*.m:
compiler/*.m:
Undo Zoltan's bogus update of all the copyright dates.
The dates in the copyright header should reflect the years
in which the file was modified (and no, changes to the
copyright header itself don't count as modifications).
Estimated hours taken: 0.5
library/random.m:
Add documentation for the exported procedures.
Declare the undocumented random__test predicate as
`pragma obsolete' and remove it from the Mercury
library reference manual (in preperation for
deleting it in a future release).
Some minor changes to the code to make it more
readable.
Estimated hours taken: 3
Enable --warn-interface-imports by default. This was turned off while
list and term were defined in mercury_builtin.m, since it caused many
warnings.
Fix all the unused interface imports that have been added since then.
compiler/options.m:
Enable --warn-interface-imports by default.
compiler/module_qual.m:
Fix formatting inconsistencies with module names in warning
messages. (".m" was not appended to module names if there was
only one module).
compiler/*.m:
library/*.m:
tests/invalid/type_loop.m:
tests/warnings/*.m:
Remove usused interface imports, or move them into
implementation (mostly bool, list and std_util).
library/*.m:
Improve the documentation.
Add a "Stability: low/medium/high" comment to all modules,
which describes the stability of the interface to that module.
ops.m:
Add `:' as an infix operator.
require.m:
Implement require/1, since higher-order predicates now work.
term.m:
Use the type `comparison_result' from mercury_builtin.m,
rather than defining an identical type `comparison'.
library/mercury_builtin.m:
Add copy/2.
library/io.m:
Change io__get/set_globals to use unique modes.
Add a few calls to copy/2 to make things work.
library/*.m:
Add unique modes to a few predicates.
Remove unique modes in a couple of cases where they didn't work.
map.m & tree234.m:
add a __member predicate for nondeterministically getting the
members of a map or tree.
random.m:
replace the random number generator with the original proper one.
Makefile*:
Add some more stuff for compiling to .o
Makefile*, mercury_compile*, code_gen*:
Add some stuff for handling `.pp' files.
`.pp' files are Mercury source code containing
NU-Prolog hacks inside
#if NU_PROLOG
...
#endif
These hacks are preprocessed out (using sed, not cpp)
except when compiling with `mnc'.
term_io.nl, term_io.nu.nl, interpreter.nl, prog_out.nl:
Make sure all the predicates in term_io.nl are
prefixed with `term_io__', not `io__'.
term_io.nl, require.nl:
Add some `external' declarations.
call_gen.nl, unify_gen.nl:
A temporary hack - generate incorrect code for complicated/polymorphic
unifications, rather than aborting.
random.nl:
Make the code more efficient.
hlds.nl, term.nl:
Allocate pred_ids and variable numbers randomly rather than
sequentially, so that the binary trees remain reasonably balanced.
code_info.nl, unify_gen.nl, hlds_out.nl:
Generate informative comments for tag tests: say the name of
the variable being tested, and which constructor we are testing for.
llds.nl:
Cast field() expressions to (int) when used as rvals, so
that comparisons work as expected.
make_hlds.nl:
Improve error reporting.