[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 22:21:46 AEDT 2020



On Sun, 12 Jan 2020 21:19:40 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> > 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.
> 
> The two are be allowed to differ by qualification; I think that bit
> is just poorly worded.

Can you please fix it?

> > 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?
> 
> IMO, no. We should just require that the :- module declarations in
> separate sub-module are fully qualified.  (In practice, most of the code
> I work with already does that anyway.)

After my change, which I just committed, the code *should* already do that,
though I haven't tested it. So again, we should change the wording here,
though this probably warrants an entry in NEWS as well.

(We now require the :- module decl to specify the expected module name exactly,
and the expectation is set either by the file name, which now must be fully qualified,
or by mmc -f, which *should* generate an error message if it can't find an exact match
between the name in the :- module decl and the :- include_module in its putative parent.)

Zoltan.


More information about the reviews mailing list