[m-dev.] promise_impure

Ralph Becket rafe at csse.unimelb.edu.au
Fri May 25 15:23:21 AEST 2007


Julien Fischer, Friday, 25 May 2007:
> The lack of documentation for promise_impure is deliberate; it's
> a horrible thing and hopefully it will go away in the future.

To expand: currently we use purity for more conditions than we ought.
In Jakob's case he had something like

	( if p(SolverVar) then
		impure do_something(...)
	  else
		impure do_something_else(...)
	)

Because solver vars can only safely appear in negated contexts (such as
the condition of an if-then-else) in special circumstances, the compiler
currently assumes that such an occurrence is actually unsafe and
requires the programmer to put the if-then-else in a promise_purity
scope to indicate awareness of the situation.  Here the if-then-else
is impure, hence the need for a promise_impure scope enclosing the
if-then-else.

-- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list