[m-dev.] foreign type syntax

Peter Ross peter.ross at miscrit.be
Thu Oct 25 19:43:00 AEST 2001


On Thu, Oct 25, 2001 at 05:53:32PM +1000, Peter Schachte wrote:
> On Thu, Oct 25, 2001 at 01:51:21PM +1000, Tyson Dowd wrote:
> > The main benefit foreign_type gives is that when you start interfacing to
> > foreign language code you don't have to do casts or uncasts -- it is as
> > if the Mercury compiler already knows about your type the same way it
> > knows about MR_Integer or MR_Float. 
> 
> I hope you will go farther than just creating an opaque type for each
> foreign type.  It's much more helpful if you can create a constructor
> (probably really a function) for each foreign structured type.  Adding field
> accessors would be quite helpful, too.  And it will be important to handle
> the fact that most conventional languages allow some kind of NULL for any
> compound type.
> 
We already do this for the IL backend, but we use a tool to generate all
the interfaces.  Currently the pragma is purely for easing
interoperability (and on typed backends increasing the performance and
type safety of the resulting code).
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list