[m-dev.] foreign type syntax

Peter Schachte schachte at cs.mu.OZ.AU
Thu Oct 25 17:53:32 AEST 2001


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.

-- 
Peter Schachte              Any man who is under 30, and is not a liberal,
schachte at cs.mu.OZ.AU        has not heart; and any man who is over 30, and
www.cs.mu.oz.au/~schachte/  is not a conservative, has no brains.
Phone: +61 3 8344 9166          -- Winston Churchill 
--------------------------------------------------------------------------
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