[m-rev.] diff: Delete unused imports.

Peter Wang novalazy at gmail.com
Wed Mar 30 14:53:26 AEDT 2022


On Wed, 30 Mar 2022 14:09:03 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 
> On Wed, 30 Mar 2022 13:26:36 +1100, Peter Wang <novalazy at gmail.com> wrote:
> > > The main reason why you have to import a module A in the interface
> > > of module B is that one of the arguments of a predicate or function
> > > exported by module B refers to a type defined in module A.
> > 
> > But does a module C that only calls the predicate/function exported by
> > module B also need to import module A?
> 
> No, it does not, but that is not the point I was trying to make. The sentence
> you quoted was not making an argument; it was only a prelude to the argument
> in the next paragraph.
> 
> > The type defined in module A is
> > never explicitly named in module C, nor constructed/deconstructed in
> > module C, so does it count as a "use"?
> 
> I am not talking about any third module C at all.
> 
> I am saying that module B needs to import module A if one of its variables
> has a type that contains a type constructor defined in module A.
> 

Ok, great.

My question was prompted by this:

> Actually, the reason why the import of vartypes was flagged as unused
> with --intermod-opt was a known limitation that we discussed in october:

If flagging vartypes as unused is due to a limitation, then would the
opposite behaviour, i.e. flagging vartypes as USED in call_gen.m,
be correct? Anyway, we both agree the answer to that is "no".

> > The reference manual doesn't
> > explain what it considers a "use".
> 
> Module A uses module B if it needs information from module B's interface
> to compile properly. While could and probably should give examples of
> what counts as as use, I think we should avoid any statement of the form
> "the above uses are the only possible uses", since such statements
> could be invalidated by future changes to the language.

Right. Still, we can always make changes to the language
as long as the reference manual is updated.

Peter


More information about the reviews mailing list