[m-dev.] interpreting C datastructures as Mercury terms

Thomas Charles CONWAY conway at cs.mu.OZ.AU
Thu May 7 16:47:21 AEST 1998


Peter Schachte, you write:
> Hmmmm.  I just had another thought.  Why can't you do what you want right
> now by defining an abstract type and defining different modes of constructor
> functions as pragma C code?  Should be simple enough.  Then it'll look to
> the user pretty much like an ordinary discriminated union type, even though
> it isn't implemented that way.

I've used this technique before - I had an RGB value which was represented
in C as a struct with three chars. It doesn't work so well in the case I
presented in my previous message because I want to take one of these things
and pass it to write/3.

-- 
Thomas Conway <conway at cs.mu.oz.au>
Nail here [] for new monitor.  )O+



More information about the developers mailing list