[m-dev.] purity of `:- pragma foreign_proc'
Peter Schachte
schachte at cs.mu.OZ.AU
Fri Nov 2 12:33:22 AEDT 2001
On Thu, Nov 01, 2001 at 05:23:52PM +1100, Tyson Dowd wrote:
> Let me collect the syntax proposals together:
>
> (1) :- pragma pure foreign_proc(...). % or semipure or impure
> (2) :- pragma promise_pure foreign_proc(...). % or promise_semipure
>
> and I'd like to throw in
>
> (3) :- pragma foreign_proc(..., [promise_pure]). % or promise_semipure
>
> Note that with (2) and (3) there doesn't seem to be any need to allow
> promise_impure but I guess we could allow it anyway and it would do
> absolutely nothing.
>
> With (1) "impure" would be completely optional and would also make no
> difference.
A variation on (1) would be to *require* one of pure, semipure or impure.
No default: you have to think about it and tell mercury what it is. That's
actually what I had intended.
Naturally, I like (1) best, and (2) a close second. (If you go with (2)
promise_pure and promise_semipure will have to be made operators. But then
the syntax for promising purity can be
:- promise_pure foo/3.
which is prettier than the current syntax.) A compromise between (1) and
(2), which I'll call (1.5), would be to use
:- pragma promise pure foreign_proc(...).
and change the promise_pure declarations to
:- pragma promise pure foo/3.
or even
:- promise pure foo/3.
I don't care for (3) very much.
--
Peter Schachte The Street finds its own uses for technology.
schachte at cs.mu.OZ.AU -- William Gibson
www.cs.mu.oz.au/~schachte/
Phone: +61 3 8344 9166
--------------------------------------------------------------------------
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