[m-rev.] for review: pragma foreign_import_module on the IL backend

Simon Taylor stayl at cs.mu.OZ.AU
Fri Dec 13 01:02:28 AEDT 2002


On 12-Dec-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> fjh wrote:
> > On 11-Dec-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > fjh wrote:
> > > > On 10-Dec-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > > compiler/ml_code_gen.m:
> > > > > The wanted foreign imports are the imports for every backend
> > > > > language.  This is because, for example, managed C++ can refer
> > > > > to something defined in IL.
> > > > >
> > > > > compiler/mlds_to_managed.m:
> > > > > For managed C++ output a #using for every module implied by the
> > > > > pragma foreign_import_module.
> > > >
> > > > Hmm.  What about cyclic imports?
> > >
> > > Cyclic imports are a problem for the .NET implementations.
> >
> > Only for C# and MC++, not for IL or Mercury -- right?
> >
> Cyclic imports are a problem for all languages which check interface
> definitions by obtainining the information from an assembly.  Neither pure
> Mercury (but Mercury with foreign code does) or IL do that, so yes you are
> right.
> 
> > If Mercury's foreign_import_module declaration does not permit cyclic
> > imports for C# or MC++ code, this should be mentioned in the Mercury
> > language reference manual.
> >
> I will add a mention of this.
> 
> > > This is a
> > > general problem with using assemblies to hold both the interface and the
> > > implementation.  The programmer must ensure that they don't introduce a
> > > cyclic dependency.  Note that mmake will report a cyclic dependency
> warning
> > > and that combined with the failure to build a file because of a missing
> > > assembly should be enough for the programmer to debug the problem.
> >
> > What happens with `mmc --make'?
> > Will the user still get a warning about the cyclic dependency in that
> case?
> >
> I don't know.  Do you Simon?  I will test it when I have a chance.

`mmc --make' currently assumes there are no dependencies between
`.dll' files and any files created for other modules. With
foreign_import_module for IL, this will have to change from

	target_dependencies(_, il_asm) = il_code `of` self.

to something like:

	target_dependencies(_, il_asm) = 
		combine_deps_list([
			il_code `of` self,
			il_asm `of` foreign_imports
		])

Currently `mmc --make' aborts by calling
`error("make_module_target: target being built, circular dependencies?")'
if it detects cyclic dependencies. This should probably be changed so
that it just prints an error and returns failure if the circular
deependency is for an `il_asm' target file.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list