[m-rev.] for post-commit review: break up modules.m

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jul 22 03:13:56 AEST 2008


On Mon, 21 Jul 2008, Zoltan Somogyi wrote:

> I will address any issues post-commit. The main thing that needs checking
> is whether I made any mistakes in replacing 'yes's and 'no's when introducing
> purpose-specific types. I have done a scan of the diff myself, but a second
> one couldn't hurt.
>
> Zoltan.
>
> The file modules.m contains lots of different kinds of functionality.
> While much of it belongs together, much of it does not. This diff moves
> most of the functionality that does not belong with the rest to several
> new modules:
>
> 	libs.file_util
> 	parse_tree.deps_map
> 	parse_tree.file_names
> 	parse_tree.module_cmds
> 	parse_tree.module_imports
> 	parse_tree.read_module
> 	parse_tree.write_deps_file
>
> To make them coherent, move some predicates from hlds.passes_aux,
> parse_tree.prog_io and parse_tree.prog_out to the new modules, making them
> more accessible, reducing the required access from the hlds package to
> parse_tree, or from the parse_tree package to libs.
>
> In the same spirit, this diff also moves some simple predicates and functions
> dealing with sym_names from prog_util.m to mdbcomp/prim_data.m. This allows
> several modules to avoid depending on parse_tree.prog_util.
>
> Rename some of the moved predicates and function symbols where this avoids
> ambiguity. (There were several that differed from other predicates or function
> symbols only in arity.)
>
> Replace several uses of bools with purpose-specific types. This makes some
> of the code significantly easier to read.
>
> This diff moves modules.m from being by far the largest module, to being
> only the seventh largest, from 8900+ lines to just 4200+. It also reduces
> the number of modules that import parse_tree.modules considerably; most
> modules that imported it now import only one or two of the new modules instead.
>
> Despite the size of the diff, there should be no algorithmic changes.

This change breaks `mmc --make'.  Attempting to build a single module program
using `mmc --make foo' now results in:

 	Making Mercury/int3s/foo.int3
 	** Error: error reading file `builtin.m' to generate dependencies.
 	** Module `builtin' is imported or included by module `foo'.
 	mercury_compile: cannot find source for module `builtin' in directories .

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list