Files
mercury/NEWS
Simon Taylor fc8725fc3c Allow arbitrary mappings from source file name to module name.
Estimated hours taken: 8
Branches: main

Allow arbitrary mappings from source file name to module name.
The mapping is created using the command `mmc -f *.m', which must
be run before `mmake depend'.

compiler/parse_tree.m:
compiler/source_file_map.m:
compiler/notes/compiler_design.html:
	Add a new module to read, write and search the mapping.

compiler/modules.m:
	Use the source file map when searching for source files.

	Export `make_directory' for use by source_file_map.m.

	Use the module name rather than the source file name to
	generate the executable name. This matches the documentation
	in the User's Guide, and it's needed to make the tests work.

compiler/prog_io.m:
	Separate out the code to read the first item in a module to
	find the module name into a new predicate, `find_module_name'.

compiler/handle_options.m:
	Don't complain about the module name not matching the file
	name when generating the Mercury.modules file -- the file
	only needs to be generated when the module name doesn't
	match the file name.

compiler/llds_out.m:
	Remove a duplicate copy of `make_directory'.

compiler/options.m:
compiler/mercury_compile.m:
doc/user_guide.texi:
	Add the `--generate-source-file-mapping' (-f) option
	to generate the mapping.

NEWS:
	Document the change.

tests/hard_coded/Mmakefile:
tests/hard_coded/source_file_map.m:
tests/hard_coded/mapped_module.exp:
	Test case.
2002-04-15 05:04:23 +00:00

323 lines
14 KiB
Plaintext

NEWS since Mercury release 0.10.1:
----------------------------------
HIGHLIGHTS
==========
Changes to the Mercury language:
* Improved support for higher-order functions.
* Predicate and function equivalence type and mode declarations.
* Support for defining predicates or functions
using different clauses for different modes.
* Support for Haskell-like "@" expressions.
Changes to the Mercury compiler:
* A new `--smart-recompilation' option, for fine-grained dependency tracking.
* A new optional warning: `--warn-non-tail-recursion'.
* A new optimization: `--constraint-propagation'.
* Support for arbitrary mappings from module name to source file name.
Major improvements to the Mercury debugger, including:
* Support for source-linked debugging using vim (rather than emacs).
* Command-line completion.
* Ability to display values of higher-order terms.
Numerous minor improvements to the Mercury standard library.
DETAILED LISTING
================
Changes to the Mercury language:
* If a higher-order function term has inst 'ground' it is now assumed to have
the standard higher-order function inst 'func(in, .., in) = out is det'.
This makes higher-order functional programming much easier, particularly when
passing functions to polymorphic predicates.
This change is not completely backwards compatible since, for safety,
we must now disallow calls that would cause a variable that has a
nonstandard function inst to become 'ground'.
* Predicate and function type and mode declarations can now be expressed
in terms of higher-order predicate and function types and insts, rather
than explicitly listing the argument types and modes. This is useful
where several predicates or functions must have the the same type and
mode signature.
For example:
:- type foldl_pred(T, U) == pred(T, U, U).
:- inst foldl_pred == (pred(in, in, out) is det).
:- pred p `with_type` foldl_pred(T, U) `with_inst` foldl_pred.
For more information see the "Predicate and function type declarations"
section of the "Types" chapter and the "Predicate and function mode
declarations" section of the "Modes chapter" of the Mercury Language
Reference Manual.
* The constructor for lists is now called '[|]' rather than '.'.
`./2' will eventually become the module qualification operator.
This change only affects programs which use `./2' explicitly.
Programs which only use the `[H | T]' syntax will be unaffected.
* We've added a new kind of expression to the language.
A unification expression, written `X @ Y', unifies X and Y
and returns the result.
Unification expressions are most useful when writing switches:
p(X, X) :- X = f(_, _).
can now be written as
p(X @ f(_, _), X).
See the "Data-terms" section of the "Syntax" chapter of the
Mercury Language Reference Manual for more details.
* We've extended the language to allow you to specify different clauses
for different modes of a predicate or function. This is done by
putting mode annotations in the head of each clause.
For example, you can write
:- mode p(in).
:- mode p(out).
p(X::in) :- ... /* clause for the `in' mode */
p(X::out) :- ... /* clause for the `out' mode */
For predicates or functions which have different clauses for different
modes, you need to either (1) add a `pragma promise_pure' declaration
for the predicate or function, and ensure that the declarative semantics
remains the same in each mode, or (2) declare the predicate as impure.
* We now allow `:- pragma promise_semipure' declarations. For more
information, see the "Impurity" chapter of the Mercury Language
Reference Manual.
* We've added `:- pragma c_import_module' declarations, which are
used to make the C declarations for predicates and functions with
`:- pragma export' declarations in the imported module visible
to any C code in the importing module. `mmake' uses
`:- pragma c_import_module' declarations to make sure that the
header file for the imported module is built before it is needed,
which it can't do if the header file is explicitly #included.
* We've removed the undocumented operators `export_adt', `export_cons',
`export_module', `export_op', `export_pred', `export_sym', `export_type',
`import_adt', `import_cons', `import_op', `import_pred', `import_sym',
`import_type' `use_adt', `use_cons', `use_op', `use_pred', `use_sym'
and `use_type'. These operators were reserved for module system
extensions which are unlikely to be implemented.
Changes to the Mercury standard library:
* Performance bugs in `pprint__to_doc' have now been fixed. Even
very large terms can now be converted to docs and pretty printed without
causing a machine to thrash or run out of memory.
* `io__read_file' and `io__read_file_as_string' now have better error
handling. The result types have changed, so code using these predicates
will need minor modifications.
* We've added predicates `io__input_stream_foldl', `io__input_stream_foldl_io'
and `io__input_stream_foldl2_io', which apply a predicate to each character
of an input stream in turn.
* We've added versions of `io__print', `io__write' and `io__write_univ'
that allow the caller to specify how they should treat values of noncanonical
types, e.g. types in which a single semantic value may have more than one
syntactic expression.
* We've added four new predicates to allow programs to retrieve current
streams: `io__current_input_stream', `io__current_output_stream',
`io__current_binary_input_stream', and `io__current_binary_output_stream'.
* We've added a predicate to io.m to return the last modification time
of a file: `io__file_modification_time'.
* We've added cc_multi modes to io__write_list/5 and io__write_list/6.
* We've added four functions to list.m for mapping functions over
corresponding members of lists: list__map_corresponding/3,
list__map_corresponding3/4, list__filter_map_corresponding/3
and list__filter_map_corresponding3/4.
* We've added some other new functions to list.m, namely
list__last_det/2, list__split_last/3 and list__split_last_det/3.
* We've added cc_multi modes to list__foldl/4 and list__foldr/4.
* We've added a predicate list__map_foldl2.
* As mentioned above, the constructor for lists has changed from './2'
to `[|]/2'. This change affects the behaviour of the term manipulation
predicates in the standard library when dealing with values of
type `term__term/1' representing lists. The affected predicates are
parser__read_term, parser__read_term_from_string, term__type_to_term,
term__term_to_type, term_io__read_term and term_io__write_term.
Also beware that std_util__functor and std_util__deconstruct now
return `[|]' rather than `.' for lists, and calls to std_util__construct
which construct lists may need to be updated.
* We've added a predicate list__map_foldl2.
* We've added a function version of error/1, called func_error/1, to require.m.
* ops.m now defines a typeclass which can be used to define operator
precedence tables for use by parser.m and term_io.m. See
samples/calculator2.m for an example program.
The `ops__table' type has been renamed `ops__mercury_op_table'.
`ops__init_op_table' has been renamed `ops__init_mercury_op_table'.
`ops__max_priority' is now a function taking an operator table argument.
* The predicates and functions in int.m, float.m, math.m and array.m now
generate exceptions rather than program aborts on domain errors and
out-of-bounds array accesses. There are new functions
`float__unchecked_quotient/2', `int__unchecked_quotient/2' and
`int__unchecked_rem/2' for which no checking is performed and the
behaviour if the right operand is zero is undefined.
* We've removed the reverse modes of the arithmetic functions in
float.m and extras/complex_numbers. (Because of rounding errors,
the functions aren't actually reversible.)
* float__pow now works for negative exponents, and runs much faster
for large exponents.
* We've removed the destructive update modes of string__set_char,
string__set_char_det and string__unsafe_set_char. The compiler
currently always stores constant strings in static data, even
if they are passed to procedures with mode `di', so any attempt
to update a constant string will cause a crash. Fixing this properly
will be a lot of work, so for now we have just removed the modes.
* The exception module has a new predicate `try_store', which is
like `try_io', but which works with stores rather than io__states.
* We've fixed a bug in time.m. Type `tm' didn't store the day of the month,
which meant that the functions which required that field (e.g. time__asctime,
time__mktime) did not work.
The order of the fields of type `time__tm' has been changed so that
comparison of values of type `tm' whose `tm_dst' fields are identical
is equivalent to comparison of the times those values represent.
* std_util.m now contains predicates and functions `map_maybe',
`fold_maybe', `map_fold_maybe' and `map_fold2_maybe', which are
analogues of `list__map', `list__foldl', `list__map_foldl' and
`list__map_foldl2' operating on values of type `maybe' instead
of `list'.
* We've added a predicate to io.m to return the last modification time
of a file (io__file_modification_time).
* There is a variant of io__call_system, io__call_system_return_signal
which on interrupt returns the number of the signal which interrupted
the command rather than just an error message.
* We've added added several new predicates for deconstructing terms to
std_util.m. `named_argument' and `det_named_argument' are analogous
to `argument' and `det_argument' respectively, but specify the desired
argument by its name, not its position. We have also added committed choice
version of all the predicates that deconstruct terms. These differ from the
existing versions in that they do not abort when called upon to deconstruct
non-canonical terms, such as values of types with user-defined equality.
* We've added a new predicate `intersect_list' in each of the modules
implementing sets in the Mercury standard library.
* We've added a predicate version of `set__fold'.
* We've added function versions of `builtin__unsafe_promise_unique',
`ops__init_op_table' and `ops__max_priority'.
* We've added a version of `getopt__process_options' which returns
the option arguments.
* `getopt__process_options' has been modified to allow negation of
accumulating options. Negating an accumulating option empties
the accumulated list of strings.
* We've added some functions to the term_io module to return printable
representations of term components as strings.
* We've made the outputs of the string concatenation primitives unique.
* New convenience/readability predicates `int__even/1' and `int__odd/1'.
* We've removed the long obsolete `int__builtin_*' and
`float__builtin_float_*' predicates, which were synonyms
for the arithmetic functions dating from when Mercury didn't
have functions.
* We've removed the long obsolete predicates `io__read_anything',
`io__write_anything', and `io__print_anything', which were long ago
renamed as `io__read', `io__write', and `io__print' respectively.
Changes to the extras distribution:
* The interface to Moose has been changed in a non-backwards compatible
way to support user-defined modes for the parser state and integrate
better with lex.
Changes to the Mercury compiler:
* The Mercury compiler can now perform smart recompilation, enabled by the
`--smart-recompilation' option. With smart recompilation, when the
interface of a module changes, only modules which use the changed
declarations are recompiled. Smart recompilation does not yet work
with `--intermodule-optimization'.
* The Mercury compiler can now handle arbitrary mappings from source files
to module names. If the program contains modules for which the source
file name does not match the module name, before generating the
dependencies the command `mmc -f SOURCES' must be run, where `SOURCES'
is a list of the names of all of the source files. If the names of the
source files all match the contained module names, `mmc -f' need not be run.
* We've added a new compiler option `--warn-non-tail-recursion', which
causes the compiler to issue a warning about any directly recursive
call that is not a tail call.
* We've fixed a long-standing bug in the handling of module imports.
Previously, if `module1' imported `module2' which imported `module3' in
its interface section, then any types, insts, modes and typeclasses defined
in the interface of `module3' could be used in `module1' even
if `module1' did not import `module3' directly.
This change will break some existing programs, but that is easily fixed
by adding any necessary `:- import_module' or `:- use_module' declarations.
* Options for the Mercury runtime can now be set at compile time using
the new `--runtime-flags' option of ml and c2init.
* We've added a new optimization pass -- constraint propagation.
Constraint propagation attempts to transform the code so
that goals which can fail are executed as early as possible.
It is enabled with the `--constraint-propagation' option
(or `--local-constraint-propagation' for a more restricted
version of the transformation).
* The `--convert-to-goedel' option has been removed.
It never really worked anyway.
Changes to the Mercury debugger:
* The debugger can now print goals just as Prolog debuggers do. At an exit
port of e.g. append, the command "print goal" will print the current goal
in a form such as "append([1], [2], [1, 2])".
* You can now navigate terms in the debugger by argument name as well as by
argument number.
* The debugger can now print higher order values.
* The debugger can now print type_info structures. However, since such
structures are normally of interest to implementors only, the debugger
will print such values only if the user gives the command "print_optionals
on".
* The debugger can now perform command line completion when compiled
with GNU Readline support enabled.
* We've added a 'view' command to `mdb', which opens a `vim' window and
in it displays the current source location, updated at each event. This
requires X11 and a version of `vim' with the `clientserver' feature
enabled.
* The `--window' mdb option now creates a window for mdb, not
the program. The main advantage of the new behaviour is that
redirection of the program's input and output works. The old
behaviour is still available with `mdb --program-in-window'.
For news about earlier versions, see the HISTORY file.