[m-rev.] for review: improvements for foreign_type

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jun 28 20:47:16 AEST 2002


On 28-Jun-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> 
> Improvements for `:- pragma foreign_type'.
> - Allow default Mercury definitions. The Mercury definition must define
>   a discriminated union type. The type is treated as abstract except
>   in predicates or functions which have implementations for all the
>   foreign languages the type has implementations for (the check for
>   this isn't quite right).
> - Allow polymorphic foreign types.
> - Don't require the `:- pragma foreign_type' for exported foreign types
>   to be in the interface. We now only require that all definitions
>   have the same visibility.

I haven't reviewed the code, but the log message looks good.

At first I was a bit worried about the last part, because I was afraid
it would prevent the compiler from using the foreign type representation
in code generated for Mercury clauses.  Instead it would need to use a
generic representation (e.g. Object).  However, I realized that the same
problem arises with abstract equivalence types, and whichever solution
we adopt for that will also work for abstract foreign types.
E.g. our current solution of requiring --intermodule-optimization
should be sufficient.

> compiler/make_hlds.m:
> 	Handle Mercury definitions for foreign types.
> 
> 	Separate out the code to add constructors and special predicates
> 	to the HLDS into a separate pass.

It might be a good idea to put that in a separate module,
if it is reasonably large (e.g. >= 400 lines).


-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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