[m-dev.] call for opinions on promise_same_solutions syntax

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Feb 27 15:12:02 AEDT 2006


On Mon, 27 Feb 2006, Julien Fischer wrote:

> Most probably yes (but see below), consider this example that came up when we
> were originally implementing mutables:
>
> 	:- pred p(io::di, io::uo) is det.
>
> 	p(!IO) :-
> 		promise_pure(
> 				impure set_mutable(3)
> 		).
> vs.
> 	:- pragma promise_pure(p/2).
> 	:- pred p(io::di, io::uo) is det.
>
> 	p(!IO) :-
> 		impure set_mutable(3).
>
> where:
>
> 	:- impure set_mutable(int::in) is det.
> 	:- pragma foreign_proc("C", set_mutable( ...
>
> The problem with the former is that at many optimization levels the compiler
> will happily optimize it away.
>

By "it", I mean the promise_pure goal.

Julien.
--------------------------------------------------------------------------
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