Estimated hours taken: 5
[This change was by Ralph Becket.
I'm just the person who reviewed it and committed it. -fjh.]
Add functions for the single output det predicates in a number
of modules in the standard library. Basically, for each
:- pred f(in, ..., in, out) is det.
I have added the declaration
:- func f(in, ..., in) = out.
and definition
f(X1, ..., Xn) = Y :-
f(X1, ..., Xn, Y).
library/char.m:
library/dir.m:
library/map.m:
library/string.m:
library/list.m:
library/set.m:
Make the changes described above.
library/array.m:
As above, except array input modes are all array_ui or
array_di as appropriate and array output modes are array_uo.
library/int.m:
Added forward versions of +/2, */2 and -/2 as plus/2, times/2
and minus/2 respectively, to make it easier to pass these
as arguments to higher-order predicates.
Also added func constants for max_int, min_int and bits_per_int.
library/integer.m:
Replaced local functions for list head, tail and length with
calls to equivalent functions now defined in list.m.
library/io.m:
Added func for error_message/2.
library/list.m:
Add functions det_head/1 and det_tail/1 which abort on null lists.
library/set.m:
Add functions map/2, filter_map/2 and fold/3.
library/std_util.m:
Added utility function to construct a pair object from its
arguments and general purpose higher order functions for
partial functions and for function composition, exponentiation
and exchanging the arguments of a binary function.
Estimated hours taken: 5
Remove support for NU-Prolog and SICStus Prolog.
The reasons for this are:
(a) We now have a proper working debugger, so we don't need to use
NU-Prolog or SICStus Prolog for debugging.
(b) The Prolog support was only ever a hack, not a proper solution;
Mercury language features like functions or mode reordering
were never supported.
(c) It was a maintenance problem.
compiler/make_hlds.m:
Warn that NU-Prolog `when' declarations are deprecated.
compiler/prog_io.m:
Update a comment to say that NU-Prolog `when' declarations
are now deprecated.
library/*.m:
Delete `when' declarations.
configure.in:
bindist/bindist.configure.in:
Delete the autoconf tests for NU-Prolog and SICStus Prolog.
Delete the stuff for generating the NU-Prolog and SICStus Prolog
scripts.
tools/bootcheck:
Delete the options for testing using SICStus Prolog.
library/Mmakefile:
Delete the rules for building NU-Prolog and SICStus Prolog stuff.
library/library.nu.nl.in:
library/swi_*.m:
library/*.nu.nl:
library/array.nu.nl:
library/assoc_list.nu.nl:
library/char.nu.nl:
library/float.nu.nl:
library/int.nu.nl:
library/io.nu.nl:
library/library.nu.nl.in:
library/map.nu.nl:
library/mercury_builtin.nu.nl:
library/nc_builtin.nl:
library/require.nu.nl:
library/sp_builtin.nl:
library/sp_lib.nl:
library/std_util.nu.nl:
library/store.nu.nl:
library/string.nu.nl:
library/swi_builtin.m:
library/swi_lib.m:
library/term_io.nu.nl:
Delete these files.
scripts/mnc.in:
scripts/mnp.in:
scripts/mnl.in:
scripts/msc.in:
scripts/msl.in:
scripts/msp.in:
Delete these files.
doc/user_guide.texi:
Delete the documentation about the Prolog support.
NEWS:
w3/news/newsdb.inc:
Mention that we've removed the Prolog support.
Estimated hours taken: 3
Add predicates to perform lower-bound and upper-bound searching, in which
if a search for a key fails, we return the next lower (or higher) key and
its associated value.
library/bintree.m:
library/rbtree.m:
library/tree234.m:
library/map.m:
Add lower-bound and upper-bound search and lookup predicates.
Add plain lookup predicates where missing, or move them next
to their corresponding search preds.
Make the handling of lookup errors more uniform.
library/require.m:
Move map__lookup_error here as report_lookup_error, for use
by bintree, rbtree and tree234, as well as map.
Estimated hours taken: 1
library/map.m:
Fix a cut-and-paste error in the comment for map__det_union where
it was referring to map__insert instead map__union.
Delete the error message argument from map__det_union
and map__det_insert, for consistency with other det_* predicates,
and to make them easier to use.
Estimated hours taken: 2
library/map.m:
Add some predicates that may be generally useful. Some of them
are needed in a near-future change to the compiler.
NEWS:
Mention the new predicates.
Estimated hours taken: 0.1
library/map.m:
Use map__lookup_error for the other map predicates
which abort on missing or duplicate keys.
library/map.nu.nl:
Fix the message for map__det_insert_error.
Estimated hours taken: 0.25
library/map.m:
Split the error handling code from map__lookup into a seperate
predicate map__lookup_error. The reason for this is two-fold:
(1) this makes it for the compiler to inline map__lookup
without inlining all the error handling code
(2) it can be handy to be able to set a breakpoint on
map__lookup_error.
Estimated hours taken: 0.5
NEWS:
mention the changes to map and tree234.
library/map.m:
added map__foldl/4 and map__map_values/3 which forward to the
corresponding predicates in tree234.
library/tree234.m:
implement tree234__foldl and tree234__map_values.
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: 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).
Estimated hours taken: 4
Improved the error messages for map__lookup failure by writing out the types
of the values and keys.
Also, since the Prologs cannot handle the type_of functions, a `normal'
version of map__lookup has been added to map.nu.nl
To accomodate this, this change implements a mechanism to override
definitions of predicates for particular Prologs. This mechanism makes
explicit which .no or .ql files contain preds overriding others, and so
makes things a bit more robust.
library/map.m:
Implement the better error messages.
library/map.nu.nl:
The Prolog version of map__lookup.
library/Mmakefile:
Set new environment variables, MERCURY_NU_OVERRIDING_LIB_OBJS or
MERCURY_SP_OVERRIDING_LIB_OBJS to be the files which are to be
linked, but contain definitions which override others.
scripts/mnl.in:
Link everything in MERCURY_NU_OVERRIDING_LIB_OBJS last.
scripts/msl.in:
Link everything in MERCURY_SP_OVERRIDING_LIB_OBJS last.
Estimated hours taken: 0.25
library/map.m:
Move a couple of `import_module' declarations from the
interface to the implementation, because they were not
needed in the interface.
Estimated hours taken: 8
Bug fixes for higher_order.m and unused_args.m
NEWS
Removed the message about bugs in unused_args.m and higher_order.m
compiler/options.m
Re-enabled higher_order and unused_args.
compiler/unused_args.m
Fixed so that this now handles partially instantiated
deconstructions correctly.
compiler/higher_order.m
Two bug fixes:
Specialization of types for specialized versions of predicates.
Fixed handling of curried arguments.
compiler/inlining.m, compiler/type_util.m:
Moved inlining:apply_substitution_to_type_map and
inlining:apply_rec_substitution_to_type_map to type_util.m
for use in the higher_order.m bug fix.
library/varset.m
Added predicate varset__new_vars which returns a list of new
variables.
library/term.m
Added predicates term__apply_variable_renaming(_to_list)
to apply a variable renaming (map(var, var)) to a term
or list of terms.
library/map.m
Added map__det_insert_from_corresponding_lists to insert
multiple key-value pairs into a map.
tests/valid/{Mmake, higher_order2.m, higher_order3.m, unused_args_test2.m}
Tests for the bug fixes.
varset:
Add some new predicates for the excess assignment pass.
std_util, assoc_list:
Move predicates for associative lists to a new module.
*.m:
Import assoc_list.
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.
map.nl:
Add predicates map__det_insert, map__det_update, and map__det_remove.
These are like their semidet equivalents except that they will
call error/1 rather than failing.
Use of map__set when map__det_insert or map__det_update would do
is henceforth frowned apon!
Makefile.mercury:
Override the MERCURY_LIB_OBJS variable when invoking ml.
This avoids some bootstrapping problems.
Also, add mercury_compile.nu.
Makefile.common:
Bump NU-Prolog's -u option up to 2000 (8M), to avoid some memory
problems.
array.nl, bintree.nl, char.nl, dir.nl, globals.nl, list.nl, map.nl, modes.nl,
prog_util.nl, stack.nl, std_util.nl, string.nl, term.nl:
Avoid the use of implied modes.
code_info.nl, bimap.nl, make_hlds.nl, mercury_compile.nl,
mercury_to_mercury.nl, unify_proc.nl:
Fix determinism errors which had previously not been discovered
because of either implied modes or running out of memory.
(Note that I had to change the interface to bimap__lookup, since
it's not possible to make it bidirectional.)
code_util.nl, llds.nl, opt_debug.nl, value_number.nl:
Rename `operator' as `binary_op'.
hlds.nl, code_info.nl, unify_gen.nl, llds.nl, opt_debug.nl, switch_gen.nl:
*** Handle simple cases of higher-order pred terms. ***
(We don't yet handle taking the address of an overloaded
predicate or a predicate with multiple modes.
We don't handle closures. call/1 and call/N are not yet implemented.
This has not yet been tested.)
make_hlds.nl:
Modify the mode priority ordering so that semidet modes get
selected before det ones.
llds.nl:
Don't include the priority part of the mode number in the mangled
label name. *** Note: this will break some things! ***
mercury_compile.nl:
Move the NU-Prolog hacks into mercury_compile.nu.nl.
switch_gen.nl:
Fix a simple logic bug in handling the grab/slap of the code_info.
prog_io.nl, builtins.nl, int.nl:
Fix bugs and omissions with handling of the new arithmetic operators.
prog_io.nl:
As a quick hack, strip off calls to io__gc_call
(this avoids spurious error messages which are due to
the fact that we don't get mode analysis right in those cases).
code_info.nl:
Tidy up the code for code_info__cons_id_to_tag.
prog_io.nl, mode_util.nl, mercury_to_mercury.nl:
Add new inst `free(Type)' and new inst_names `typed_ground(Type)'
and `typed_inst(Type, Inst)' so that we can propagate type
information through the mode system.
Do some of the work necessary to propagate type info to modes.
type_util.nl:
Add an extra output argument to type_to_type_id so that it can
return the type's arguments; also fix a determinism error in
type_to_type_id.
hlds.nl:
Add a comment.
list.nl:
Fix the determinism annotation for same_length.
map.nl:
Add map__apply_to_list.
mode_info.nl:
Add mode_info__get_types_of_vars.
bintree.nl, map.nl, varset.nl:
Remove map__search_insert; it's not needed and it's not
really useful.
bintree.nl:
Fix determinism problem in bintree__from_list_2.
options.nl, det_analysis.nl, make_hlds.nl:
Add options to suppress determinism warnings.
det_analysis.nl, hlds.nl, modes.nl:
Allow the delta-instmap to be `unreachable'.
hlds_out.nl:
Output the delta-instmap.
Output conjunctions differently in verbose mode.
llds.nl:
Fix determinism problem.
Change GOTO(LABEL(...)) into GOTO_LABEL(...) which can be
more efficient.
map.nl:
Add map__overlay/3.
typecheck.nl, modes.nl, mode_errors.nl, options.nl, hlds_out.nl.
Split the old `debug' option into debug-types and debug-modes.
Change the default for the `modecheck' option to `yes'.
Add a new verbose-dump-hlds option, and use that instead
of the very-verbose option in hlds_out.nl.
mode_util.nl:
Export mode_get_insts/4.
Add instmap_lookup_var (moved from modes.nl).
Add apply_instmap_delta.
modes.nl, term.nl, prog_util.nl:
Add determinism annotations.
term.nl, prog_io.nl:
Fix bugs in when declarations.
std_util.nl, prog_io.nl:
Add a maybe(T) type to std_util.nl.
Rename the maybe(T) type in prog_io.nl as maybe1(T).
Makefile:
various changes. Added switch_gen.nl renamed the other codegen
files to fit the naming conventions.
array.nl:
added some determinism declarations.
bimap.nl:
fixed some of the determinism problems.
doit.nl:
minor changes.
hlds.nl:
added liveness to the procinfo structure.
added access predicates and type definition for liveness_info.
hlds_out.nl, modes.nl:
patched the explicit usage of proc/11. for the above change.
int.nl:
fixed it so that it compiles under mc!
map.nl, set.nl, term.nl:
fixed determinism warnings.
toplevel.nl:
import code_info.
various:
file renaming to fit naming conventions.
prog_io.nl, hlds.nl:
Add `arity' as an alias for `int'.
map.nl:
Improve the code for map__merge.
Add map__optimize.
Work-around a bug in the determinism analysis.
make_hlds.nl:
Use map__optimize rather than bintree__balance.
codegen.nl, std_util.nl:
Add a call to `semidet_succeed' in codegen.nl, and
implement that pred in std_util.nl, in an
attempt to suppress a determinism warning.
(The attempt failed, due to an as-yet unknown bug in
the determinism analysis.)
hlds.nl, modes.nl, mode_util.nl, mercury_to_mercury.nl, undef_modes.nl.
Replace the inst table with four tables, one for
user-defined insts, and three for compiler-generated
insts. Modify all the routines dealing with insts to
handle this. Change `inst_merge' in modes.nl to return
a compiler-generated recursive inst if necessary.
term_io.nl:
Fix bugs caused by recent changes to io__xxx_op preds.
Makefile, apply_sed_script, fix_errs.sed:
A quick hack to avoid the spurious determinism errors.
term_io.nl, char.nl, string.nl:
Add a few additional utility preds to string.nl.
Add some more preds to handle quoting to term_io.nl.
Remove the stuff which handled quoting in char.nl.
bintree.nl:
fix bintree__remove/4 so that it fails rather than aborts.
(probably want both variants actually...)
char.nl:
added char__escape/2 for escaping characters.
Possibly redundant, but if such code exists, then where is it?
io.nl
added io__write_strings to print each of a list of strings and
io__write_escaped_char to escape a character and print it.
map.nl:
added map__merge. Could be better implemented probably. We need
to address issues like determinism.
map.nl:
Fix performance bug due to use of NU-Prolog's `some'.
(Improved the speed of checking for undefined types by a factor
of 20 - now takes 1s for codegen.nl instead of 20s.)
list.nl:
Comment out the difficult modes for same_list.
(A temporary hack until the mode system is improved.)
make_hlds.nl:
Fix scoping errors.
prog_io.nl:
Fix scoping error introduced by the DCG expansion of if-then-else.
map.nl:
Add map__is_empty/1.
mercury_to_mercury.nl:
Fix error in mode declaration.
modes.nl:
Fix bug where the waiting_goals_table in the delay_info structure
was not being correctly updated when we exited a conjunction
which contained a mode error.
queue.nl:
Use `[A|B]' instead of `A.B'.
Add a when declaration.
typecheck.nl:
Fix mode error.
Makefile:
Add a rule to create *.ugly using mercury_compile's
`--convert-to-Mercury' option.
set.nl:
Add set__singleton_set/2.
hlds.nl:
Change mode_is_input and mode_is_output so that abstract
insts are assumed to be bound.
Add predicate `inst_is_ground'.
Add predicate `moduleinfo_set_num_errors'.
Also change instmap_delta back into a map again (probably a mistake! -
but I'll fix it later).
map.nl:
Add predicate `map__from_sorted_assoc_list'.
mercury_to_mercury.nl:
Export `mercury_output_inst' and `mercury_output_mode_list'.
modes.nl:
Lots of changes. It should be almost useable now.
options.nl:
Add a new --modecheck option to invoke the mode checker.
This is disabled by default since the modechecker doesn't
quite work yet.
parser.nl:
Remove obsolete comment.
prog_io.nl:
Ensure that the bound insts in a bound(...) list are in sorted
order.
set.nl:
Add predicate `set__sorted_list_to_set'.
toplevel.nl:
Changed to match the new interface to `modecheck'.
Also don't generate code if there were any errors detected by
make_hlds.
typecheck.nl:
Fix a couple of minor typos in the error messages.
bintree.nl, map.nl, std_util.nl:
Use assoc_list/2 rather than list(pair(...)).
hlds.nl, det_analysis.nl:
Make instmap delta an association list rather than a map;
fix the determinism analysis to use that.
Makefile, doit.nl:
Add det_analysis.nl and builtins.nl.
builins.nl:
Fix bug.
codegen.nl:
Make unimplemented cases abort rather than just fail.
modes.nl, typecheck.nl:
Fix bugs introduced by the performance fixes.
(I wonder if the performance problem will come back now? ;-)
options.nl, toplevel.nl:
Add a new pred `maybe_flush_output' and use it in toplevel.nl.
bintree.nl:
Added bintree__values/2, bintree__from_sorted_list/2, and
bintree__balance/2.
io.nl:
Add missing `:- import_module std_util' declaration.
list.nl:
Add sort/2.
map.nl:
Add map__values/2.
set.nl:
Add set__to_sorted_list/2.
Improve the code for set__from_list/2.
typecheck.nl:
Fix the bug with type var set synchronization and overloaded
functors. As a result, also had to change the checking for
unresolved type errors.
Also fix some problems with some of the error messages.
llds.nl:
Add an XXX comment.
--------------------
options.nl, prog_io.nl:
Add a -I option.
--------------------
bintree.nl:
Add predicates to work out the depth and number of items
in a bintree.
map.nl:
Make the fact that maps are bintrees externally visible,
so that toplevel.nl can print out some stats about some maps.
toplevel.nl:
Print out some stats about the pred, type, and cons maps.