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

Peter Wang novalazy at gmail.com
Thu Mar 31 11:19:38 AEDT 2022


On Thu, 31 Mar 2022 10:42:39 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 
> On Wed, 30 Mar 2022 16:17:07 +1100, Peter Wang <novalazy at gmail.com> wrote:
> > > I don't agree. I have been saying that mmc's correct behavior for the version
> > > of call_gen.m that includes an implementation section import of vartypes.m,
> > > is NOT to generate an unused import warning for that import.
> > > 
> > 
> > Then call_gen.m must be using an entity exported by vartypes.m, correct?
> > Can you explain to me what constitutes the "use" in call_gen.m?
> 
> Deciding what the target language type should be of the target language
> variable that holds the value of the Mercury variable whose type is "vartypes",
> which is a type that is exported by vartypes.m. For the LLDS backend,
> the only thing it needs to know whether to reserve two words for it instead
> of one, as for a 64 bit double on a 32 bit platform, but when generating
> Java or C#, the code generator needs to know the specific target language type.

It's not necessary for call_gen.m to directly import vartypes.m to get
that information, though. The module rules require the module declaring
the predicates that call_gen.m calls, i.e. hlds_pred.m, to import
vartypes.m in the interface.


I think "use" is about resolving names. If a source file mentions a name
"foo" which refers to a "foo" in another module, that's a use.
The other "use" I can think of is importing a module for its typeclass
instances. An instance declaration may be used without being explicitly
named.

Peter


More information about the reviews mailing list