[m-rev.] for review: foreign type imports

Peter Ross peter.ross at miscrit.be
Thu Oct 25 18:17:06 AEST 2001


On Thu, Oct 25, 2001 at 03:13:20PM +1000, Tyson Dowd wrote:
> On 24-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Hi,
> > 
> > For Tyson to review.
> > 
> > With this change the main branch is now able to use the intgen tool
> > provided you re-enable parsing of the prog_io pragma.
> > 
> > ===================================================================
> > 
> > 
> > Estimated hours taken: 0.5
> > Branches: main
> > 
> > Port the change to handle foreign imports onto the main branch.
> > 
> > The foreign_type pragma allows one to specify where a declaration for a
> > foreign type is located, thus this import must be output in the correct
> > source module.
> 
> You need to improve this log message to be much more precise. 
> 
> What declaration are you talking about?  Isn't foreign_type declaring a
> type?  
> What import?  When did foreign types start implying imports?  Why?
> What source module are you talking about?  The Mercury source module is
> what seems to be the most obvious meaning, but I doubt it is what you
> meant.
> 
> Perhaps an example would make it clearer...
> 

I will change this to 

If we wish to use the following foreign type

:- pragma foreign_type(xmldoc, 'System__Xml__XmlDoc', il("System.Xml")).

then we must include in the generated code a reference to the assembly
System.Xml so as to obtain the definition of System.Xml.XmlDoc.  This
change implements this.


> >     
> > compiler/ml_code_gen.m:
> >     For each foreign type add its location to the list of mlds imports.
> 
> I'm not very keen on the way this is done.
> I feel the code in this section is very simple because it is just a hack
> -- what if a type requires 2 imports or more for some case in the future?
> Or if the imports can't be just turned into mlds_module_names so easily?
> 
> A more general mechanism would add foreign imports as part of the HLDS,
> and then process those imports and add them to the MLDS here. 
> 
> Also we should allow different sorts of foreign imports in the MLDS,
> instead of just putting a flag on ordinary imports.
> 
> But it's a bit of work for no immediate gain, so I'm not sure whether it
> is worth doing right now.
> 
I will implement the discriminated union idea from below, but leave the
rest for later if it becomes necessary.

Pete
--------------------------------------------------------------------------
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