library/array.m:
library/builtin.m:
library/construct.m:
Fix copy-and-paste errors.
library/arrayd2d.m:
Use the mode array2d_di instead of array_di in a spot.
Delete an extra space from an exception message.
library/bimap.m:
Fix formatting.
library/bit_buffer.m:
Fix inverted argument types.
library/dir.m:
Say that make_single_directory/4 returns an error rather
than saying that it fails.
library/io.m:
Fix errors in obsolete pragmas.
library/assoc_list.m:
library/bag.m:
library/cord.m:
library/deconstruct.m:
library/enum.m:
library/fat_sparse_bitset.m:
library/getopt*.m:
library/int*.m:
library/io*.m:
library/type_desc.m:
Fix documentation errors.
tests/hard_coded/array2d_from_array.exp:
Conform to the changed exception message in array2d.m.
library/bt_array.m:
Reorder the arguments of the resize and shrink predicates
to make them easier to use with state variables.
tests/general/array_test.m:
Update the test calls to these two predicates.
library/version_array2d.m:
Rewrite part of this module using a programming style that includes
variable names that are longer than one character :-(. In the absence
of comprehensive, or even basic, test cases, leave the rest using
the old style.
Add a non-field-syntax lookup operation.
Mark the site of a probable bug.
library/version_bitmap.m:
Add non-field-syntax versions of the get_bit and set_bit operations.
NEWS.md:
Announce the reordering and the new predicates above.
library/getopt.m:
library/getopt_io.m:
Apply to getopt_io.m an update that was previously applied to getopt.m,
even though getopt.m is now computed from getopt_io.m.
library/array2d.m:
library/bit_buffer.m:
library/bit_buffer.read.m:
library/bit_buffer.write.m:
library/bitmap.m:
library/cord.m:
library/edit_distance.m:
library/edit_seq.m:
library/fat_sparse_bitset.m:
library/fatter_sparse_bitset.m:
library/list.m:
library/one_or_more.m:
library/pair.m:
library/ra_list.m:
library/rbtree.m:
library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_tree234.m:
library/set_unordlist.m:
library/solutions.m:
library/sparse_bitset.m:
library/test_bitset.m:
library/thread.barrier.m:
library/thread.m:
library/thread.semaphore.m:
library/time.m:
library/tree_bitset.m:
library/version_array.m:
library/version_hash_table.m:
library/version_store.m:
General updates to style, the main ones being the following.
Using standard names for type variables:
- K and V for key and value types in map-like structures
- A to F for types of accumulators
- T for most everything else, possibly with a numeric suffix
to distinguish two separate types that nevertheless play
similar roles.
(I left descriptive type var names such as Stream and Store unchanged.)
Adding or expanding descriptions of exported predicates and functions.
Declaring and defining field syntax getters and setters without using ^,
while keeping the use of field syntax, including ^, in the operations'
descriptions.
Defining field syntax operations operations in terms of the
non-field-syntax versions, not vice versa.
Defining function versions of operations in terms of the predicate
versions, not vice versa.
library/ra_list.m:
As above.
Rename ra_list_lookup to ra_list_search, since it fails if the item
to be accessed does not exist. Add a version, ra_list_lookup, which
aborts in that case.
Add predicates to append two ra_lists, and to convert ra_lists
to just plain lists.
Change the argument order of some predicates to be more
state variable friendly.
Add some documentation.
library/bt_array.m:
Delete the moved code, and update the references to the changed predicates.
library/Mercury.options:
Now that the ra_list predicates have been moved to their own module,
stop giving bt_array.m a free pass on inconsistent predicate order.
library/MODULES_DOC:
library/library.m:
Add ra_list.m as a documented module of the Mercury standard library.
library/array.m:
Delete a predicate that served as a test for an ancient bug fix.
NEWS:
Announce both the new ra_list module, and the deletion of the predicate
from array.m.
tests/hard_coded/array_sort.m:
Don't call the predicate deleted from array.m.
tests/hard_coded/ra_list_test.{m,exp}:
A new test case to test operations on ra_lists.
tests/hard_coded/Mmakefile:
Enable the new test case.
library/array.m:
library/bt_array.m:
library/pprint.m:
In each of these modules,
- put related predicates next to each other,
- put the groups of related predicates into a meaningful order, and
- improve the documentation of some predicates, and
- improve some variable names in the implementation, including giving
explicit names to some function results.
library/Mercury.options:
Enable the warning about inconsistent predicate order for two of those
modules, but not bt_array.m, pending a decision about making its
informal "submodule" an actual separate module.
In the Mercury standard library, every exported predicate or function
has (or at least *should* have) a comment that documents it, including
the meanings of its arguments. About 35-40% of these modules put `'s
(left and right quotes) around the names of the variable representing
those arguments. Some tried to do it consistently (though there were spots
with unquoted or half quoted names), while some did it only a few places.
This is inconsistent: we should either do it everywhere, or nowhere.
This diff makes it nowhere, because
- this is what the majority of the standard library modules do;
- this is what virtually all of the modules in the compiler, profiler,
deep_profiler etc directories do;
- typing all those quotes when adding new predicates in modules that
follow this convention is a pain in the ass; and because
- on many modern terminals, `' looks non-symmetrical and weird.
Likewise, the comment explaining a predicate often started with
% `predname(arguments)' returns ...
This diff deletes these quotes as well, since they add nothing useful.
This diff does leave in place quotes around code fragments, both terms
and goals, where this helps delineate the boundaries of that fragment.
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/array.m:
library/bt_array.m:
Do not assume that the lower bound is zero in the documentation for
array.max.
Make explicit the argument order of bounds/3 predicates
and document behaviour on empty arrays.
This fixes Mantis bug #412.
compiler/unused_imports.m:
Consider that an instance declaration makes a module "used" only if
it occurs in the module being compiled, not in an imported or ancestor
module. (Mantis bug 412 was caused by instance declarations in implicitly
imported modules.)
Fixing #412 also exposed another bug. When computing the set of modules
used by predicates, we considered (besides some non-type entities)
only the types of the predicate's arguments, not the types of non-argument
variables. In one case in the compiler (mmc_analysis.m), this lead to
some actually-used modules not being marked as such, which lead to
false unused-import warnings to be generated for them. Fix this by scanning
the types of all variables in all of a predicate's procedures, not just
the arguments.
Improve the infrastructure for debugging similar problems.
Note some possibilities for future improvement.
Change a predicate name to fit the naming scheme.
compiler/analysis.m:
Add an XXX about a possible improvement.
compiler/hlds_out_module.m:
Make the output we generate for instance methods more readable.
As part of this, fix an old bug in the printing of the instance table:
the first line of the first method of each concrete instance declaration
was accidentally commented out.
compiler/parse_tree_out.m:
Export a different utility predicate for hlds_out_module.m. Make its name
conform to the scheme used by related predicates.
browser/browse.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_special_pred.m:
compiler/check_for_missing_type_defns.m:
compiler/check_promise.m:
compiler/exception_analysis.m:
compiler/handle_options.m:
compiler/inst_match.m:
compiler/mercury_to_mercury.m:
compiler/ml_tailcall.m:
compiler/module_qual.m:
compiler/op_mode.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_tree_out_clause.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_out_pragma.m:
compiler/parse_tree_out_pred_decl.m:
compiler/parse_tree_out_term.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/prog_ctgc.m:
compiler/recompilation.usage.m:
compiler/resolve_unify_functor.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/write_deps_file.m:
library/bt_array.m:
Delete unused imports.
compiler/module_qual.qual_errors.m:
Import a module that the parent module_qual.m doesn't import anymore.
tests/warnings/bug412.{m,exp}:
The test case for this bug.
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
Enable the new test case.
tests/invalid/import_in_parent.err_exp:
Update the expected output for this test case. The parent module
does not use the imported module (bool) at all, so this is what the
error message says after this diff, though its submodule does use bool.
NOTE: this change does not affect the io module -- I've left that for a
separate change.
library/*.m:
As per the recent change to the coding standard, avoid module
qualification in library interfaces where possible.
Reformat declarations and descriptive comments to better utilise
any space freed up by the above.
Estimated hours taken: 1
Branches: main
Various minor cleanups and syntax updates for the standard library.
There are no changes to any algorithms.
library/injection.m:
library/set.m:
library/sparse_bitset.m:
Use promise_equivalent_clauses where appropriate.
library/set_ordlist.m:
library/set_unordlist.m:
Convert these module to 4-space indentation:
Convert these module to 4-space indentation
library/*.m:
Convert some if-then-elses into switches.
Remove unnecessary module qualification - this is related
mainly to the breakup of std_util and the fact that on
the 0.13 branche we had two versions of the all-solutions
predicates.
Various other style cleanups.
vim/syntax/mercury.vim:
Highlight promise_equivalent_clauses appropriately.
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
Branches: main
Remove the assumption on user supplied comparison predicates that
C(X, Y, =) implies X = Y (similarly for comparison functions). Our code
shouldn't need to assume this, and sometimes more general orderings are
useful (for example, when you only want to compare the key of a key-value
pair). The existing assumptions were not documented anywhere, so we now
document the remaining assumptions in builtin.m.
With this assumption gone the issue of the stability of library sorting
predicates that allow a user supplied ordering arises, since elements may
be equivalent according to the ordering even though they are not equal.
Therefore modify the documentation of standard library predicates to make
clear what we do with equivalent elements, and make minor modifications to
the code to ensure that it does as we claim.
Although the builtin comparison predicates are guaranteed to satisfy the
assumption, we nevertheless remove it from the implementation of predicates
in list.m that use builtin comparison. The rationale for this is that we
don't need the assumption, and it may not be robust if in future we ever
decide to allow user defined comparison.
NEWS:
Mention the changed assumptions about user supplied comparison
predicates and functions.
Mention the new predicate exported from list.m.
library/builtin.m:
Add types comparison_pred/1 and comparison_func/1, and corresponding
insts. Document the assumptions we make about comparison predicates
and functions.
library/list.m:
Modify sort/3, sort_and_remove_dups/3, merge/4 and
merge_and_remove_dups/4, as well as any functional versions, to use
the new types. Document the stability of sorting, and modify the
code to ensure that we conform to this.
Add remove_adjacent_dups/3, which takes a user supplied comparison
predicate and determines whether elements are duplicates based on
this, rather than the usual equality.
Modify the implementation of some predicates that use compare, to
avoid the unnecessary assumption.
Fix some spelling and grammatical errors.
library/array.m:
library/bt_array.m:
Modify the interface of {,bt_}array__bsearch to use the new types
and insts. Update the documentation.
tests/hard_coded/Mmakefile:
tests/hard_coded/stable_sort.exp:
tests/hard_coded/stable_sort.m:
A test case that checks the stability of list__sort.
Estimated hours taken: 5
Allow field access functions to take extra arguments.
Change the field update function names from `'field:='/2' to `'field :='/2'.
compiler/make_hlds.m:
Handle field names with arguments.
compiler/hlds_pred.m:
Add " :=" as the suffix for a field update function,
rather than ":=".
compiler/typecheck.m:
Update instances of `field:='/2 in comments.
compiler/det_util.m:
compiler/simplify.m:
`det_info_vartypes' was defined using the `field:=' syntax.
Change it into a normal predicate for bootstrapping.
library/array.m:
library/bt_array.m:
library/map.m:
Add field access functions `elem/2' and `'elem :='/3'.
For maps, the `elem' function calls `map__search',
so add field access functions `det_elem' and `det_elem :='
to call `map__lookup' and `map__det_update'.
NEWS:
doc/reference_manual.tex:
Document the changes.
Improve readability by changing occurrences
of `X^field' to `X ^ field'.
tests/hard_coded/typeclasses/record_syntax.{m,exp}:
Test field names with arguments.
tests/invalid/record_syntax_errors.err_exp:
Update the expected output.
Estimated hours taken: 6
library/pqueue.m:
library/assoc_list.m:
library/getopt.m:
library/bag.m:
library/bimap.m:
library/bintree.m:
library/bintree_set.m:
library/bt_array.m:
library/eqvclass.m:
library/graph.m:
library/group.m:
library/queue.m:
library/rbtree.m:
library/stack.m:
library/term.m:
library/varset.m:
library/tree234.m:
library/relation.m:
library/set.m:
library/set_bbbtree.m:
library/set_ordlist.m:
library/set_unordlist.m:
Ralph Becket <rwab1@cam.sri.com>'s changes to add functions for
the remaining output det predicates in a number of modules in the
standard library. Basically, for each
:- pred f(in, ..., in, out) is det.
he has added the declaration
:- func f(in, ..., in) = out.
and definition
f(X1, ..., Xn) = Y :-
f(X1, ..., Xn, Y).
The changes were made using a mostly automatic process.
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: 1
A few small changes towards supporting backtrackable destructive update
better.
library/mercury_builtin.m:
Add new insts mdi/1 and mostly_dead/0.
library/array.m:
Change the name of the inst for unique arrays
from `array' to `uniq_array' (someone got over-enthusiastic
with global search and replace when uniq_array.m was
renamed array.m).
Add insts for non-unique arrays and mostly-unique arrays.
library/bt_array.m:
Add a comment.
Estimated hours taken: 6
The main purpose of this change is to rename array.m as bt_array.m, and
uniq_array.m as array.m. The interfaces of those two modules have grown
slightly so that they match a little more closely. Details are in the
file NEWS.
The implementation of bt_array (formerly array) has been changed to use
a slightly more efficient implementation.
NEWS:
Interface changes documented.
library/array.m:
library/bt_array.m:
Changes mentioned above and detailed in the NEWS file.
library/uniq_array.m:
Bereft of life and resting in peace.
library/io.m:
library/library.m:
library/std_util.m:
library/term.m:
compiler/base_type_layout.m:
runtime/deep_copy.c:
runtime/type_info.h:
Minor changes to fix the special case of base_type_layout
operations for arrays rather than uniq_arrays.
tests/hard_coded/write.exp:
tests/hard_coded/write.m:
Test writing of arrays.
tests/general/array_test.exp:
tests/general/array_test.m:
Test some array/bt_array operations.