library/io.m:
library/prolog.m:
Move the definitions of see/seen/tell/told and their binary variants
from io.m to prolog.m, leaving behind forwarding predicates that are
marked obsolete.
library/robdd.m:
Replace tell/told with output to specified streams.
Where exported predicates sent output to the current output stream,
add a version that sends output to a user-specified stream.
This required replacing user-provided predicates that wrote a variable
to the current output stream with a user-provided function that simply
returns the string representation of the variable, so that the resulting
string could be printed to a *specified* stream.
NEWS:
Document the changes above.
compiler/mode_constraint_robdd.m:
compiler/mode_robdd.implications.m:
Conform to the changes above.
compiler/simplify_goal_call.m:
Warn about calls to see/seen/tell/told in prolog.m as well as io.m.
Warn about the binary versions of see/seen/tell told, and
the binary versions of set_{in,out}put_stream.
tests/warnings/save.{m,exp}:
Call prolog.see instead of io.see, since we want to test the warning
from simplify_goal_call.m, not the warning about io.see being obsolete.
configure.ac:
Require step 1 to be installed.
library/prolog.m:
Add back here the definition of "is" that was deleted from int.m.
compiler/parse_goal.m:
Don't accept "is" as a synomym for "=".
NEWS:
Announce the 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.
One option, --warn-non-contiguous-decls, generates warnings if the
mode declarations of a predicate or function aren't in a contiguous block
immediately following the pred or func declaration. Since this is a rare
kind of "style error", this option is enabled by default.
Two options, --warn-inconsistent-pred-order-clauses and
--warn-inconsistent-pred-order-foreign-procs, warn about inconsistencies
between (a) the order in which predicates (and functions) are declared,
and (b) the order in which they are defined. The two options differ in
their scope. The latter applies to all predicates and functions defined
in the module, while the former applies only to those whose definitions
include Mercury clauses.
Since an exported predicate or function may need nonexported auxiliary
predicates and/or functions, imposing a single order the declarations and
definitions of *all* the predicates and functions in a module is not a good
idea. Instead, both options divide the predicates and functions defined
in a module two groups, the exported and the nonexported, and expect
a consistent order only within each group.
The result is output that looks like this:
time.m:021: Warning: the order of the declarations and definitions of the
time.m:021: exported predicates is inconsistent, as shown by this diff:
time.m:021:
time.m:021: --- declaration order
time.m:021: +++ definition order
time.m:021: @@ -1,7 +1,7 @@
time.m:021: predicate `clock'/3
time.m:021: -predicate `time'/3
time.m:021: predicate `times'/4
time.m:021: function `clk_tck'/0
time.m:021: +predicate `time'/3
time.m:021: function `difftime'/2
time.m:021: predicate `localtime'/4
time.m:021: function `localtime'/1
compiler/options.m:
doc/user_guide.texi:
Add the new options.
compiler/style_checks.m:
A new module that generates the new warnings if warranted.
compiler/check_hlds.m:
compiler/notes/compiler_design.html:
Include and document the new module.
compiler/mercury_compile_front_end.m:
Invoke the new module if any of the three new options is set.
compiler/hlds_pred.m:
Record the item number of every predicate, function, and mode declaration
in the module being compiled. We need this for information for the
new warnings.
compiler/hlds_module.m:
Record the context of the module declaration. We use this context
for warnings about inconsistent order, since there isn't a better one.
compiler/hlds_clauses.m:
Add a mechanism to retrieve the item numbers of a set of clauses
even if they are contiguous.
Document some old data types.
compiler/error_util.m:
Add a new phase for style checks.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/from_ground_term_util.m:
compiler/lambda.m:
compiler/make_hlds.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/stm_expand.m:
compiler/table_gen.m:
compiler/unify_proc.m:
Conform the changes to the HLDS above.
compiler/typecheck_errors.m:
Fix style of error messages.
library/array2d.m:
library/assoc_list.m:
library/benchmarking.m:
library/bit_buffer.write.m:
library/bool.m:
library/builtin.m:
library/construct.m:
library/cord.m:
library/counter.m:
library/float.m:
library/injection.m:
library/lazy.m:
library/lexer.m:
library/ops.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/prolog.m:
library/queue.m:
library/rational.m:
library/require.m:
library/stack.m:
library/std_util.m:
library/store.m:
library/thread.semaphore.m:
library/tree234.m:
library/univ.m:
library/version_store.m:
Move declarations or definitions around to avoid some of the warnings
that we can now generate. (There are many more left.)
Make some minor style improvements in the process.
tests/warnings/inconsistent_pred_order.{m,exp}:
tests/warnings/non_contiguous_decls.{m,exp}:
New test cases to test the new options. They are both copies of
tests/benchmarks/queens.m, with intentionally-screwed-up style.
tests/warnings/Mmakefile:
Enable the new test cases.
tests/warnings/Mercury.options:
Specify the options being tested for the new test cases.
tests/benchmarks/queens.m:
Bring the style of this module up to date (before copying it).
tests/invalid/mode_decl_in_wrong_section.err_exp:
Expect the warnings we now generate.
Estimated hours taken: 0.5
Branches: main
Remove a bug workaround in the the thread module.
Misc. minor changes to library modules.
library/thread.m:
Delete the workaround for the bug with foreign_import_module pragmas
and sub-modules on the lowlevel backends.
library/deconstruct.m:
library/sparse_bitset.m:
library/varset.m:
Delete duplicate imports.
library/io.m:
library/thread.semaphore.m:
s/which/that/ in a spot.
library/prolog.m:
Convert this module to 4-space indentation.
library/dir.m:
library/getopt.m:
library/getopt_io.m:
library/lexer.m:
Fix some formatting so that it conforms to our current coding
standard.
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: 32
Branches: main
Make the Prolog term comparison operators (@<, @=<, @>, @>=)
builtin since they're often useful and calling compare/3
can look a little awkward.
Simplification now applies the following transformations on the
new builtin operators:
X @< Y ---> some [R] (compare(R, X, Y), R = (<))
X @=< Y ---> some [R] (compare(R, X, Y), R \= (>))
X @> Y ---> some [R] (compare(R, X, Y), R = (>))
X @>= Y ---> some [R] (compare(R, X, Y), R \= (<))
compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/table_gen.m:
Added `only_mode' argument to calls to
goal_util__generate_simple_call which now has an extra parameter.
compiler/goal_util.m:
Added a new parameter, ModeNo, to goal_util__generate_simple_call.
ModeNo is either
- `only_mode' in which case the predicate in question is expected to
have exactly one mode or
- `mode_no(N)' in which case mode number N (counting from 0) is
used.
The inequality transformation uses this to handle calls to compare/3
with unique arguments (even though the builtin inequality modes don't
yet handle ui arguments...)
compiler/simplify.m:
simplify__goal_2 for calls now makes a decision as to whether to
call simplify__call_goal or simplify__inequality_goal. The bulk
of simplify__goal_2 is now in simplify__call_goal. The
inequality transformation is handled in simplify__inequality_goal.
compiler/type_util.m:
Added comparison_result_type constant.
compiler/NEWS:
Mention these changes.
library/builtin.m:
Added the inequalities as built-ins.
Added the function ordering/2.
library/prolog.m:
Removed the definitions for @< etc.
Estimated hours taken: 600
Branches: main
Implemented state variable transformation.
NEWS:
Record new syntax and withdrawl of !/0 as Prolog cut.
compiler/hlds_goal.m:
compiler/hlds_out.m:
Added implicit/1 constructor to unify_main_context for cases where
variables are introduced by compiler transformations.
compiler/make_hlds.m:
Integrated the state variable transformation with the conversion to
HLDS.
Changed references to foreign_type and du_type constructors to
match recent changes to the foreign type interface.
compiler/mercury_compile.m:
Removed two unnecessary Prolog cuts left over from the Dark
Ages.
compiler/mercury_to_mercury.m:
Added code to output the new goal_expr constructors for state
variable quantifiers (some_state_vars and all_state_vars.)
Adapted to handle changes to if_then and if_then_else
goal_expr constructors which now include lists of state
variables that scope over the condition- and then-goals.
compiler/module_qual.m:
compiler/prog_util.m:
Changes to handle some_state_vars, all_state_vars, and changes
to if_then and if_then_else goal_expr constructors.
compiler/prog_data.m:
Added some_state_vars, all_state_vars constructors and changed
if_then and if_then_else constructors in type goal_expr.
compiler/prog_io_dcg.m:
Changes to handle quantified state variables.
compiler/prog_io_goal.m:
parse_some_vars_goal now also separates out quantified state
variables.
compiler/prog_io_util.m:
Added pred parse_quantifier_vars/3 which also detects state
variables.
compiler/typecheck.m:
Added case to report_error_undef_cons to handle any uncaught
uses of !/1.
doc/reference_manual.texi:
Documented the transformation.
library/builtin.m:
library/prolog.m:
Deleted code for `!' as fake Prolog cut.
library/lexer.m:
Made `!' a graphic token rather char than a special token.
library/ops.m:
Added `!', `!.' and `!:' as prefix ops.
library/term.m:
Added func var_id/1 which returns an int associated with its
var argument which is unique in the context of the given var
and the varset it belongs to.
library/varset.m:
Added pred new_uniquely_named_var/4 which creates a named
variable with a unique (w.r.t. the varset) number suffix.
tests/general/Mmakefile:
tests/general/state_vars_tests.exp:
tests/general/state_vars_tests.m:
tests/general/state_vars_typeclasses.exp:
tests/general/state_vars_typeclasses.m:
tests/invalid/Mmakefile:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/state_vars_test1.m:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test2.m:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/state_vars_test3.m:
tests/invalid/state_vars_test4.err_exp:
tests/invalid/state_vars_test4.m:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/state_vars_test5.m:
Added.
Estimated hours taken: 6
Fix various invasions of the user's namespace by `mercury_builtin.m',
by splitting mercury_builtin.m into two modules, called builtin.m and
private_builtin.m, and ensuring that the latter is imported as if
by `:- use_module' rather than `:- import_module'.
library/builtin.m:
library/private_builtin.m:
Split mercury_builtin.m into two modules, builtin.m,
which contains stuff intended to be public,
and private_builtin.m, which contains implementation
details that are not supposed to be public.
library/mercury_builtin.m:
Add a comment saying that this module is no longer used, and
should eventually be removed. I have not removed it yet, since
that would prevent bootstrapping with the current compiler. It
will be removed as a seperate change later, once all the
changes have propagated.
compiler/prog_util.m:
Change the definition of mercury_private_builtin_module/1 and
mercury_public_builtin_module so that instead of automatically
importing mercury_builtin.m as if by `import_module', the
copiler will now automatically import builtin.m as if by
`import_module' and private_builtin.m as if by `use_module'.
compiler/polymorphism.m:
Change a call to mercury_private_builtin_module/1 for
unsafe_promise_unique to instead call mercury_public_builtin_module/1.
compiler/unify_proc.m:
Avoid hard-coding "mercury_builtin" by instead
calling one of mercury_{private,public}_builtin_module/1.
runtime/mercury_type_info.[ch]:
library/term.m:
library/std_util.m:
compiler/code_util.m:
Change a few hard-coded instances of "mercury_builtin"
to "builtin" or "private_builtin" as appropriate.
runtime/mercury_trace_util.c:
runtime/mercury_trace_internal.c:
library/prolog.m:
compiler/*.m:
Update comments that refer to "mercury_builtin" to instead
refer to either "builtin" or "private_builtin".
doc/Mmakefile:
Don't include the interface to private_builtin.m in the
library reference manual.
tools/bootcheck:
Add `-p'/`--copy-profiler' option. This is needed to get
the above changes to bootstrap.
tools/test_mercury:
Pass `-p' to tools/bootcheck.
tests/term/*.trans_opt_exp:
s/mercury_builtin/builtin/g
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/prolog.m:
Use explicit double-underscore module qualifiers in the definitions of
the Prolog operators, so that for Prolog the definitions here do
not override the builtin Prolog definitions.
Estimated hours taken: 0.5
Various bits of cleaning up.
NEWS:
library/io.m:
library/prolog.m:
library/std_util.m:
library/term.m:
tests/hard_coded/expand.m:
Rename `expand' as `deconstruct'.
Remove some Term_To_Type predicates (they were all just calls
to fatal_error anyway).
library/std_util.m:
Make error messages more standard in layout, make sure they
refer to ML_expand rather than just expand.
library/std_util.m:
library/mercury_builtin.m:
Remove some Term_To_Type predicates (they were all just calls
to fatal_error anyway).
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
library/std_util.m:
Move arg/3 and det_arg/3 into prolog.m.
Change argument/3 and det_argument/3 from predicates to functions.
library/prolog.m:
New file, contains Prolog compatibility hacks.
Change the definition of arg/3 (from std_util.m) so that we define
it with a module qualifier (prolog__arg) rather than overriding
the builtin Prolog arg/3; this fixes a problem which broke things
in NU-Prolog.
library/library.m:
Add `import_module prolog' declaration.