[m-rev.] for review: require module a.b to be a.b.m without mmc -f

Zoltan Somogyi zoltan.somogyi at runbox.com
Sun Jan 12 20:43:30 AEDT 2020



On Sun, 12 Jan 2020 19:16:32 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> > diff --git a/doc/reference_manual.texi b/doc/reference_manual.texi
> > index d5e7bd565..c6828c147 100644
> > --- a/doc/reference_manual.texi
> > +++ b/doc/reference_manual.texi
> > @@ -5342,12 +5342,21 @@ Each of the named sub-modules in an @samp{:- include_module} declaration
> >  must be defined in a separate source file.
> >  The mapping between module names and source file names
> >  is implementation-defined.
> > -(For a module named @samp{foo.bar.baz},
> > -The University of Melbourne Mercury implementation
> > -requires the source to be located in a file named
> > - at file{foo.bar.baz.m}, @file{bar.baz.m}, or @file{baz.m}.)
> > -The separate source file must contain the declaration (interface)
> > -and definition (implementation) of the sub-module.
> > +The University of Melbourne Mercury implementation requires that
> 
> Are we still referring to it as the "The University of Melbourne Mercury implementation"?
> (The reference manual seems to be split as to whether its that or simply the 
> the Melbourne Mercury impelmentation.)

I deleted "University of" in all contexts except the historically appropriate ones.
There were no such inappropriate references in the other .texi files.

> > + at itemize
> > + at item @emph{either} every module should be
> 
> s/should/must/
> 
> > +in a file named whose name is the module name followed by @samp{.m},
> 
>      ... is the fully qualified module name ...

Done both. Also fixed "named whose name".

I am somewhat concerned by theparagraph that follows the above:

The source file of a separate sub-module must contain
the declaration (interface) and definition (implementation) of the sub-module.
It must start with a @samp{:- module} declaration
which matches that in the @samp{:- include_module} declaration in the parent,
followed by the interface and (if necessary) implementation sections,
and it may optionally end with a @samp{:- end_module} declaration.
(Note: the module names in the @samp{:- module}, @samp{:- end_module},
and @w{@samp{:- include_module}} declarations need not be fully-qualified.
However, if the file name used for a particular module
does not include all the module qualifiers,
then the Melbourne Mercury implementation
requires the module name in the @samp{:- module} declaration
for that module to be fully qualified.)

In particular, what *exactly* does "matches the include_module in the parent"
mean? Most include_module items in the compiler just give the bare name
of the submodule; they omit the name of the parent. So the two names
definitely can differ in qualification.

And the second half says effectively that the full qualification of the module name
may come either from the :- module declaration *or* from the file name.
What would someone be trying to achieve by not writing the fully qualified name
in the :- module declaration? Is avoiding a dozen or three keystrokes a worthwhile
objective for us to support?

> > diff --git a/slice/Mmakefile b/slice/Mmakefile
> > index ad7bea30e..4e8a0d8a6 100644
> > --- a/slice/Mmakefile
> > +++ b/slice/Mmakefile
> > @@ -88,7 +88,14 @@ endif
> >  .PHONY: depend
> >  depend:	$(MDBCOMP_MODULES) $(DEPENDS)
> > 
> > -$(DEPENDS): SLICE_FLAGS $(MDBCOMP_MODULES)
> > +$(DEPENDS): Mercury.modules SLICE_FLAGS $(MDBCOMP_MODULES)
> > +
> > +# This directory contains source files for which the module
> > +# name doesn't match the file name, so smart recompilation
> > +# won't work without the Mercury.modules file.
> > +.PHONY: Mercury.modules
> > +Mercury.modules: SLICE_FLAGS
> 
> You shouldn't need a .PHONY directive there.

Fixed, both here and in other Mmakefiles.

> > +	$(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) -f *.m
> 
> I think you also need to update the realclean_local target to remove
> Mercury.modules.

Again, fixed both here and in other Mmakefiles.

I also added an entry to NEWS, with the reason for the change.
The updated log and diff are attached.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.sub2
Type: application/octet-stream
Size: 1549 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20200112/95693655/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.sub2
Type: application/octet-stream
Size: 23048 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20200112/95693655/attachment-0003.obj>


More information about the reviews mailing list