[mercury-users] C Interface (was Circular lists)

Tyson Dowd trd at cs.mu.oz.au
Thu Nov 27 15:03:19 AEDT 1997


On 27-Nov-1997, Richard A. O'Keefe <ok at cs.rmit.edu.au> wrote:
> 	Richard A. O'Keefe wrote:
> 
> 	>     +---------------------------------------------------------+
> 	>     | Is there some tool that can be used to verify that the  |
> 	>     | Mercury foreign interface has been used in a useful but |
> 	>     | disciplined way that CAN'T break Mercury's type system, |
> 	>     | mode system, termination verification, or other safety  |
> 	>     | features?                                               |
> 	>     +---------------------------------------------------------+
> 
>     Thomas Charles CONWAY <conway at cs.mu.OZ.AU> replied
> 
>     listing a number of cases which are cerainly safe, and some which
>     are used in a constrained way in the provided library, and assures
>     us that the Mercury team have been very careful with their use of
>     the foreign interface.
> 
> That's all good, but was never in question for an instant.
> The question was, IS THERE A TOOL?  Is there a program I can give a
> set of files to which will tell me "this is ok, that may be a gc
> problem, that other thing may be worse still".

Such a tool will likely spit out a bunch of warnings for anything apart
from trivial code. 

> Basically, I guess what I'm saying is that static checks are very much
> in the spirit of Mercury, so what static checks on the foreign interface
> are doable and likely to be done?

I don't think anyone has worked on this yet. If it would solve problems
and allow people more productivity, then it may be worth doing. You
haven't sold me on the idea yet - I can't see how it would be able to
do anything other than say "only floats and ints are safe". 

Providing a better C interface, or providing pre-written "safe" code
would probably be better. The present problem is that the C interface
is used for 2 purposes:
	1. language implementors to implement pure (and sometimes impure)
	   features for research and production purposes.
	2. users to interface with C code, in particular, pre-written
	   libraries.

The implementors need their work to be pretty raw, but users could do
with better support. In particular, it might be possible to provide
a "safe" C interface. In the past, perhaps we have worried unduly about
being too restrictive with the C interface, because as implementors
we need the freedom.

Some students may be working on the C interface this summer.

-- 
       Tyson Dowd           # 
                            #         Linux versus Windows is a 
     trd at cs.mu.oz.au        #            Win lose situation.
http://www.cs.mu.oz.au/~trd #




More information about the users mailing list