[m-dev.] purity of `:- pragma foreign_proc'
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Oct 31 16:52:27 AEDT 2001
On 31-Oct-2001, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> > Before the `:- pragma foreign_proc' syntax becomes widely
> > used, we should decide what the default purity for foreign
> > procedures should be. If we are going to make people change
> > their `:- pragma c_code' declarations to `:- pragma foreign_proc',
> > we should make any purity annotation changes happen at the same time.
> >
> > At the moment, predicates defined using `:- pragma foreign_proc'
> > are `pure' by default, but predicates defined using mode-specific
> > clauses are `impure' by default, even though `:- pragma foreign_proc'
> > can implement a strict superset of the `impure' behaviour that can be
> > implemented using mode-specific clauses.
>
> Good point. Probably impure should be the default. One simple extension
> would be to support the syntax
>
> :- pragma pure foreign_proc ...
>
> so purity could be concisely specified. Going further, Mercury could
> require one of pure, impure, or semipure to always be stated in the
> foreign_proc declaration, between pragma and foreign_proc. That approach
> would get my vote.
That sounds like a fine approach.
I think it is slightly preferable to the other two.
But I'd be happy with any of the three alternatives suggested so far.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "... it seems to me that 15 years of
The University of Melbourne | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh> | -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
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