[m-dev.] for review: C interface documentation

Fergus Henderson fjh at cs.mu.oz.au
Tue Jan 6 12:36:02 AEDT 1998


On 06-Jan-1998, Peter Schachte <pets at students.cs.mu.oz.au> wrote:
> Hi Fergus,
> 
> This looks good.  Only one comment:
> 
> > +Note that procedures implemented in C must still be ``pure'',
> > +unless declared otherwise (@pxref{Impurity}), and they must
> > +be type-correct and mode-correct.  (Determinism-correctness
> > +is also required, but it follows from the rules already stated
> > +above.)  They may perform destructive update on their
> > +arguments only if those arguments have an appropriate
> > +unique mode declaration.
> 
> Or if the changes preserves equality, as specified by the user-defined
> equality predicate of the modified terms.

That's another can of worms I'd rather not open right now.

It wouldn't be enough to just say that destructive update is allowed
if it preserves equality, because the Mercury compiler might put
data in read-only memory.

So currently the status quo is that this sort of destructive update
is not allowed.  I don't see any simple easy way of allowing it.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list