[m-rev.] for review: multiple foreign language support

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jul 18 22:21:26 AEST 2001


> > +	globals__io_get_globals(Globals),
> > +	globals__io_get_target(Target),
> > +
> > +		% Figure out what to do with this new clause.
> > +		% We can either add it to the list of clauses, ignore it,
> > +		% or replace the existing clause with it.
> > +		%
> > +		% We create a closure called UpdateClauses which does the
> > +		% appropriate action at the end of this predicate.
> > +		%
> > +		% In the rare case of multiple foreign language
> > +		% implementations we might do some unnecessary work only
> > +		% to ignore the new clause.
> > +	{ 
> > +		% no clauses -- add it
> > +		LangClauses = [],
> > +		UpdateClauses = (pred(NewCl::in, Cs::out) is det :- 
> > +			Cs = [NewCl|ClauseList])
> > +	;
> > +		% was implemented in Mercury, do nothing
> > +		% XXX if we want to make Mercury implementations a fallback
> > +		% we should consider making this a replace instead of an
> > +		% ignore.
> 
> I don't think this XXX is correct.  You already have a suitable
> foreign_proc to use, so you would never want to use the mercury code.

I think you have this around the wrong way -- this code ignores the
foreign__proc (the new clause NewCl) if the existing clause is written
in Mercury.

> What you want to do is ignore attempts to add mercury clauses when you
> already have a foreign_code implementation.

Well yes, but this happens elsewhere.

Right here we want to change it (in time) to replace mercury clauses
with foreign_proc clauses (which is what the XXX is suggesting).


> > Index: compiler/mlds_to_csharp.m
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_csharp.m,v
> > retrieving revision 1.10
> > diff -u -r1.10 mlds_to_csharp.m
> > --- compiler/mlds_to_csharp.m	2001/07/12 15:44:55	1.10
> > +++ compiler/mlds_to_csharp.m	2001/07/17 16:51:35
> > @@ -473,8 +475,14 @@
> >  	{ sorry(this_file, "value classes") }.
> >  write_il_simple_type_as_csharp_type(interface(_ClassName)) --> 
> >  	{ sorry(this_file, "interfaces") }.
> > -write_il_simple_type_as_csharp_type('[]'(_Type, _Bounds)) --> 
> > -	{ sorry(this_file, "arrays") }.
> > +write_il_simple_type_as_csharp_type('[]'(Type, Bounds)) --> 
> > +	write_il_type_as_csharp_type(Type),
> > +	io__write_string("[]"),
> > +	( { Bounds = [] } ->
> > +		[]
> > +	;
> > +		{ sorry(this_file, "arrays with bounds") }
> > +	).
> >  write_il_simple_type_as_csharp_type('&'(Type)) --> 
> >  		% XXX is this always right?
> >  	io__write_string("ref "),
> 
> This change is not mentioned in the log file.

Good point, I have sent this in as a separate change.

> 
> Otherwise this diff looks fine.

I've made the other changes you have suggested, but I will have to post
the diff I need to make to modules.m to support dependencies for
multiple languages.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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