library/hash_table.m:
Add lookup predicate.
library/version_hash_table.m:
Add lookup predicate.
Use higher-order field type with insts; delete inst casts.
Use predicates instead of functions in a couple of places.
NEWS:
Announce additions.
library/hash_table.m:
library/version_hash_table.m:
Delete hash predicates that were made obsolete in Mercury 20.06.
tests/hard_coded/test_int_hash.m:
Replace a call to a now deleted predicate.
NEWS:
Announce the deletions.
library/hash_table.m:
library/stream.string_writer.m:
Fix code where a mode specialization (i.e. the specification of
a particular input function symbol for an argument) was applied
to the wrong argument.
Such floats are one reason why the generated .cs and .java files
for stages 2 and 3 differ. After this diff, differences such as
- double Var_12 = 0.90000000000000002;
+ double Var_12 = 0.90000000000000000;
should go away.
compiler/make.module_target.m:
library/hash_table.m:
library/version_hash_table.m:
mdbcomp/slice_and_dice.m:
Replace float fractions that are not exact binary fractions with
close by fractions that are exact binary fractions. In none of these cases
was there a strong reason for the actual value originally picked.
library/hash_table.m:
Switch to using kv_lists to represent items in overflowing buckets.
This is both cleaner and more efficient.
Give many types, function symbols, predicates, functions and variables
more meaningful names.
Add XXXs to mark some significant potential problems.
When an operation has both function and predicate forms, make the
function form forward to the predicate form, as we do in the rest
of the standard library.
Make equality testing between a key in a hash bucket and a search key
explicit in all cases.
library/kv_list.m:
Add some functionality that hash_table.m now needs from kv_lists.
library/assoc_list.m:
Add some functionality that kv_list.m now has, to maintain parity
between the two modules.
NEWS:
Announce the changes to assoc_list.m. (The changes to kv_list are moot,
since it is a new module.)
tests/hard_coded/hash_table_test.{m,exp}:
Make the progress messages output by this test more meaningful,
and update its programming style.
Currently, the hash functions for (some of) the primitive types are defined in
three places:
1. The hash_table module.
2. The version_hash_table module (duplicates of the above).
3. Some (but not all) of the library modules for the primitive types.
This change makes the library module for a primitive type provide the hash
function for that type and deprecates the versions in the hash table modules.
Additionally, deprecate the "generic" has functions in the hash table modules.
library/hash_table.m:
library/version_hash_table.m:
As above.
library/char.m:
library/int.m:
library/uint.m:
Add hash/1 and hash/2.
library/float.m:
Add hash/2.
library/robdd.m:
Replace a call to the deprecated function.
NEWS:
Announce the above additions and deprecations.
tests/hard_coded/hash_table_delete.m:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/version_hash_table_delete.m:
tests/hard_coded/version_hash_table_test.m:
Conform to the above change.
Delete some procedures that have been marked as obsolete since before the 14.01
release.
library/hash_table.m:
library/version_array.m:
As above.
NEWS:
Announce the deletions.
tests/hard_coded/hash_table_delete.m:
Replace a call to one of the deleted functions.
Also, throw software_error/1 exceptions rather than directly throwing strings
in a few spots.
Undo special Ralph-style formatting.
library/*.:
As above.
tests/hard_coded/array2d_from_array.exp:
tests/hard_coded/array2d.exp:
tests/hard_coded/test_injection.exp:
Update to conform with the above change.
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.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
Specify the type constructor for every inst definition that lists
the functors that values of that type may be bound to.
In library/maybe.m, delete the inst maybe_errors/1, because
(a) its name is misleading, since it is for the maybe_error/1 type (no s),
and (b) there is already an inst with the non-misleading name maybe_error
which had an identical definition.
In compiler/dep_par_conj.m, delete two insts that were duplicates
of insts defined in hlds_goal.m, and replace references to them
accordingly.
library/hash_pred.m:
As above: implementing this in Mercury means that we now have a working
implementation for the non-C backends as well.
Provide a link to the archived version of Thomas Wang's website.
tests/Mmakefile:
tests/hard_coded/test_int_hash.{m,exp}:
Add a test the compares the above Mercury implementation to Ralph's
original C implementation.
library/hash_table.m:
Add fold2/6 and fold3/8.
library/rbtree.m:
Add foldl2_values/6.
library/assoc_list.m:
Add the predicate svremove/4, which is like remove/4 but with the
arguments in an order more conducive to the use of state variable
notation. Eventually, we should deprecate the current remove/4
and re-order its arguments so they match those of the identically
named predicates for other types that implement the map ADT.
Do not module qualify clause heads.
NEWS:
Announce the above.
compiler/module_qual.m:
The interface of a module A contains items (e.g. predicate declarations)
that refer to entities such as types, insts, modes etc. They may refer
to those entities if (a) they are defined in the interface of module A,
(b) in a parent module of module A, or (c) if they are imported from
another module, module B, which is imported into module A in the interface
of module A.
The old algorithm that attempted to enforce this requirement had a basic
design fault: it based the decision as to whether the use of an entity
in the interface was legal solely on the name of the module that defined
that entity. This correctly implements tests (b) and (c), but it does
not even attempt to implement the interface test part of (a).
It therefore allowed exported items to refer to nonexported entities.
This diff changes the whole design approach to the test. Instead of
keeping a list of modules *all* of whose entities may be used in the
interface of the current module, record for *every* entity whether
it may be used in the interface. Set the permissions differently
in the interface and implementation sections of the current module.
Improve the formatting of the ambiguity error message.
NEWS:
Announce the stricter enforcement of the documented language rules,
in a new section for potentially compatibility-breaking changes.
compiler/check_typeclass.m:
Delete a test for a special case of the situation that module_qual.m
now tests for. If this problem occurs, module_qual.m will pick it up,
and check_typeclass.m will never even be invoked, so this copy of the test
can never succeed.
library/hash_table.m:
Fix code that violated the language rules: we export a type that
includes another type, but didn't export the second type. We now do.
browser/declarative_analyser.m:
browser/declarative_edt.m:
compiler/coverage_profiling.m:
Fix code that violated the language rules. We used to export predicates
and functions whose argument types included nonexported types. As it
happens, none of those predicates and functions actually need to be
exported, so keep them private.
In coverage_profiling.m, don't abstract export a type that is not
used outside the module, and give a function a name that doesn't
clash with a type name.
tests/invalid/bug17.{m,err_exp}:
A new test case to test the error message we get if the module interface
refers to a nonexported type.
tests/invalid/bad_instance.err_exp:
This test case used to get two kinds of errors, one of which was
the illegal use of nonexported type in an exported abstract instance
declaration. We now discover this error earlier, and stop after we
do so. Update the expected error message.
tests/invalid/bad_instance2.{m,err_exp}:
New test case: a modified copy of bad_instance.m, testing the other
kind of error originally tested by bad_instance.m.
tests/invalid/instance_no_type.err_exp:
Update the expected error message.
tests/invalid/Mmakefile:
Enable the new test cases.
tests/benchmarks/query.m:
tests/hard_coded/unused_float_box_test.m:
tests/valid/bug300.m:
tests/valid/deforest_bug.m:
tests/valid/higher_order4.m:
tests/valid/lambda_recompute.m:
tests/valid/mert.m:
tests/valid/reuse_static.m:
tests/valid/switch_detection_bug2.m:
tests/valid/time_yaowl.m:
tests/warnings/unused_args_test.m:
Fix code that violated the language rules, typically by exporting
the type that previously, we illegally used in the module interface.
tests/recompilation/add_type_re.err_exp.2:
Expect the updated ambiguity error message.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
library/version_hash_table.m:
Provide a new from_assoc_list function that gives the caller more
control over the new hash table.
Provide a new function named copy to make a copy of a hash table,
this makes it easier for programmers to reason about performance when
using version hash tables.
library/hash_table.m:
Add the same functions to hash_table.m so both modules have the same
interface.
NEWS:
Announce the change.
Branches: main
Optimise hash table implementations.
library/hash_table.m:
library/version_hash_table.m:
Add ht_single constructor to reduce memory consumption
of single element chains (the common case).
Avoid an extra allocation per call to det_insert and set.
Avoid dynamic creation of type_infos in the fast path
for det_insert and set.
Inline find_slot.
Branches: 11.07, main
library/array.m:
Add an unsafe version of field update for arrays,
'unsafe_elem :='/3.
Support foldl and foldr over arrays with 3-5 accumulators.
Privately export the predicate dynamic_cast_to_array/2 from
this module. Previously, there were several definitions of
this scattered throughout the library.
Use unsafe operations (which are more efficient) in several places
where it is safe to do so.
Use state variable notation in more places.
library/int.m:
Add an additional mode to each of int.fold_up2/7 and int.fold_down2/7
with the modes (array_di, array_uo).
library/hash_table.m:
library/pprint.m:
library/version_hash_table.m:
Delete duplicate definitions of dynamic_cast_to_array/2 and use
the definition exported from the array module instead.
NEWS:
Announce the above.
Branches: main
Improve consistency amongst the standard library modules.
library/array2d.m:
library/bitmap.m:
library/hash_table.m:
library/store.m:
library/thread.semaphore.m:
library/version_array.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
library/version_store.m:
Use the name "init" for predicates and functions that create new empty
data structures instead of the name "new". (The majority of standard
library modules already use the former.)
Mark the "new" versions as obsolete.
library/bit_buffer.read.m:
library/bit_buffer.write.m:
library/io.m:
library/thread.mvar.m:
browser/declarative_execution.m:
compiler/make.m:
compiler/make.program_target.m:
ssdb/ssdb.m:
Conform to the above changes.
NEWS:
Announce the above changes.
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.
Branches: main
Add semidet modes for folds over arrays and hash tables.
library/array.m:
library/hash_table.m:
library/version_array.m:
library/version_hash_table.m:
Add semidet modes (the occasional missing mostly-unique accumulator)
to fold style predicates.
NEWS:
Announce the additions.
Branches: main, 10.04.1
library/hash_table.m:
The previous stated reason for why a fat list representation should
perform better was partly incorrect: type_info allocations for either
representation are irrelevant for the common paths.
Branches: main, 10.04
Speed up hash tables using a "fat" list representation for bucket chains,
instead of assoc_list. The benefits are less type_info constructions (an
assoc_list requires a type_info for list and a type_info for pair) and,
likely, better locality. This change speeds up hash_table_test.m by 25%,
on an x86-64 machine.
For non-version hash tables, also use unsafe array operations to avoid
bounds checks and the remaining type_info constructions. This improves on
the previous change by another 20%.
library/hash_table.m:
Use fat list representation.
Use unsafe array operations.
library/version_hash_table.m:
Use fat list representation.
NEWS:
Announce the change.
Branches: main
Replace the implementations of (version) hash tables by separate chaining hash
tables. The old open addressing scheme was broken in the presence of deletes.
Fixes bug #68.
library/hash_table.m:
library/version_hash_table.m:
As above.
We no longer use double hashing in case of a hash collision, so hash
predicates only need to return one value now.
Add fold with predicate arguments.
library/array.m:
Add array.foldl for a predicate argument.
Add array.foldl2 with a unique state pair.
library/version_array.m:
Add version_array.foldl for a predicate argument.
compiler/make.m:
compiler/make.program_target.m:
compiler/make.util.m:
library/robdd.m:
Conform to change in hashing predicates.
deep_profiler/dense_bitset.m:
Add module qualifier to avoid ambiguity.
tests/hard_coded/Mmakefile:
tests/hard_coded/hash_table_delete.exp:
tests/hard_coded/hash_table_delete.m:
tests/hard_coded/hash_table_test.exp:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/version_hash_table_delete.exp:
tests/hard_coded/version_hash_table_delete.m:
tests/hard_coded/version_hash_table_test2.exp:
tests/hard_coded/version_hash_table_test2.m:
Add new test cases.
tests/hard_coded/hash_bug.m:
tests/hard_coded/hash_init_bug.m:
tests/hard_coded/version_hash_table_test.m:
Conform to change in hashing predicates.
NEWS:
Document additions.
Branches: main
Extend `--warn-insts-without-matching-type' to warn about insts defined in the
interface which refer to constructors of types defined in the implementation.
This is usually done because Mercury doesn't (yet) support abstract insts so
the inst is exported while keeping the type abstract. However, it is not
really safe. Other modules, can see the function symbols from the inst but
cannot match them up to constructors from the type definition. Hence those
constructors never get module qualified.
This is related to Mantis bug #26.
compiler/inst_check.m:
Check that exported inst definitions have a matching type that is
visible (we can see its constructors) in the interface.
Fix some spelling.
compiler/mode_robdd.tfeirn.m:
library/array2d.m:
library/hash_table.m:
library/tree234.m:
Export previously abstract types in "secret" interface sections,
where necessary to avoid the warning.
tests/warnings/inst_with_no_type.exp:
Update expected output.
tests/warnings/inst_with_no_type.m:
Fix a comment.
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: 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: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 12
Branches: main
Remove from std_util.m the predicates that merely call predicates in
the type_desc, construct and deconstruct modules, to reduce clutter
in std_util.m.
library/std_util.m:
Remove those predicates from std_util.m.
library/deconstruct.m:
Add a type we need that was previously defined in std_util.m.
library/construct.m:
Delete some module qualifications that have now become unnecessary,
browser/browse.m:
browser/browser_info.m:
browser/declarative_tree.m:
browser/dl.m:
browser/help.m:
browser/sized_pretty.m:
browser/term_rep.m:
compiler/bytecode_gen.m:
compiler/llds_out.m:
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
library/assoc_list.m:
library/hash_table.m:
library/io.m:
library/pprint.m:
library/private_builtin.m:
library/prolog.m:
library/require.m:
library/rtti_implementation.m:
library/store.m:
library/term.m:
library/term_to_xml.m:
library/version_hash_table.m:
mdbcomp/program_representation.m:
Import type_desc.m, construct.m and/or deconstruct.m to provide
definitions of functions or predicates that up till now were in
std_util.m. Modify the calls if the called function or predicate
had a slightly different interface in std_util.m.
Also, convert term_to_xml.m to four-space indentation, and delete
unnecessary module qualifications in term.m.
tests/debugger/polymorphic_output.{m,inp,exp,exp2}:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
tests/hard_coded/elim_special_pred.m:
tests/hard_coded/existential_bound_tvar.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/higher_order_type_manip.m:
tests/hard_coded/nullary_ho_func.m:
tests/hard_coded/tuple_test.m:
tests/hard_coded/type_ctor_desc.m:
tests/hard_coded/type_qual.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested2.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/parent2.child.m:
tests/hard_coded/typeclasses/existential_rtti.m:
tests/recompilation/type_qual_re.m.1:
cvs update: Updating tests/submodules
cvs update: Updating tests/tabling
cvs update: Updating tests/term
cvs update: Updating tests/tools
cvs update: Updating tests/trailing
cvs update: Updating tests/typeclasses
cvs update: Updating tests/valid
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
tests/valid/agc_unused_in.m:
Replace references to the deleted predicates in std_util with
references to the equivalent predicates in type_desc, construct
and/or deconstruct. In test cases that already tested both the
functionality in std_util and in the other modules, simply delete
the part exercising std_util.
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, version-0_12-branch
library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
Minor reformatting; added some renamed preds and funcs to improve
consistency of naming in the library; removed some preds and types that
have been marked obsolete since 0.11.
Estimated hours taken: 8
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. Standardize format of predicate
description comments. Standardize indentation.
Estimated hours taken: 0.1
Branches: main
NEWS:
library/hash_table.m:
Don't make the predicate version of hash_table__search
obsolete. Fergus and Ralph prefer to use predicates
instead of semidet functions.
Estimated hours taken: 1
Branches: main, release
NEWS:
library/hash_table.m:
Fix a bug which caused the code to attempt to access
a negative numbered hash bucket.
Replace hash_table__search with a function, for consistency
with the rest of the interface.
tests/hard_coded/Mmakefile:
tests/hard_coded/hash_bug.{m,exp}:
Test case.
Estimated hours taken: 1
Branches: main, release
library/hash_table.m:
The arrays containing the keys and values are initialized
using the key and value of the first insertion. This was not
being done if the first insertion was done with
hash_table__det_insert rather than hash_table__set.
tests/hard_coded/Mmakefile:
tests/hard_coded/hash_init_bug.{m,exp}:
Test case.
Estimated hours taken: 0.5
Branches: main
Fix a problem where the licensing on some of the files in the Mercury
standard library was not explicitly stated.
library/bitmap.m:
library/hash_table.m:
library/pprint.m:
Update the comments about the copyright and license for these files:
mark them as copyright by the University of Melbourne, since they
have been donated to the Mercury project, and license them under the
LGPL.
Also update the layout of the %-------...-------% lines to match
our usual coding convention, so that they get formatted nicely
in the Mercury library reference manual.
Also delete "ff=unix" from the vim line for bitmap.m.
Add "stability:" comments for bitmap.m and hash_table.m
("low" since they make use of unique modes in a way that will
change when we implement ui modes and nested unique modes properly).
Estimated hours taken: 4
Allow user-defined operator precedence tables for parser__read_term
and term_io__write_term.
library/ops.m:
Define a typeclass `op_table' with methods for accessing
operator precedence tables.
Define a type `ops__mercury_op_table', representing the
standard Mercury operator table.
Make `ops__mercury_op_table' an instance of `op_table'.
Define `ops__table' as equivalent to `ops__mercury_op_table'
(it's obsolete, but we can't mark types as obsolete).
Rename `ops__init_op_table' as `ops__init_mercury_op_table',
mark ops__init_op_table as obsolete
library/parser.m:
library/term_io.m:
Add variants of `parser__read_term' and `term_io__write_term'
which take an operator precedence table.
Don't hard-code the maximum priority and argument priority.
Use the `op_table' methods to find those.
Make the priority of operator terms (X `op` Y) 1, not 100.
The reference manual states that operator terms have
the highest precedence possible.
This change slows down a program which does nothing but
parse terms by a bit under 5%, less for writing.
library/hash_table.m:
Fix a few places where parentheses are required because
operator terms now have the lowest possible priority.
`rem' is an operator -- it doesn't need backquotes.
compiler/mercury_to_mercury.m:
library/io.m:
Rename `ops__init_op_table' to `ops__init_mercury_op_table'.
Pass the `op_table' to `ops__max_priority'.
NEWS:
doc/reference_manual.texi:
Document the changes.
Add operator terms to the operator table.
In the "Terms" section of the reference manual, use the same
terminology to describe operator terms as is used in the
"Builtin Operators" section.
samples/Mmakefile:
samples/README:
samples/calculator2.m:
An example program.
tests/hard_coded/term_io_test.exp:
tests/invalid/func_errors.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/some_err.exp:
`term_io__write_term' now has the same argument priority
behaviour as `parser__read_term', so remove some unnecessary
parentheses from the output.
Estimated hours taken: 0.1
library/bitmap.m:
library/hash_table.m:
For consistency with the other library modules,
throw `require__software_error' exceptions rather
than just raw strings.
Estimated hours taken: 10
Added a new module, hash_table.m, implementing an efficient open
hash table ADT.
library/hash_table.m:
Added.
library/library.m:
Added reference to the new library module.
compiler/modules.m:
Added reference to the new library module.
NEWS:
Mentioned the new addition in the NEWS file.