[m-rev.] diff: reset contains_trace_goal if necessary

Mark Brown mark at csse.unimelb.edu.au
Thu Nov 9 16:10:41 AEDT 2006


On 09-Nov-2006, Peter Schachte <schachte at csse.unimelb.edu.au> wrote:
> On Thu, Nov 09, 2006 at 02:37:44PM +1100, Mark Brown wrote:
> > An alternative (and
> > better) way of helping users debug this problem would be to give a warning
> > whenever a promised pure goal is optimised away.
> 
> What's dubious about optimising a promised pure goal away?

Because the promise might be incorrect, and if it is the result of
optimising it away can be quite confusing.  Note that if the programmer
has gone to all the trouble of calling an impure predicate with its
intended side-effects, and then promises that there are no side-effects,
I think this is likely to be a bug.

> Would you
> also warn about optimising away a pure goal that does nothing but call
> a promised pure predicate?

I'd be inclined to give a warning for any goal being optimised away.
We already warn for duplicate calls (although the warning is not on
by default).

> The trouble with warnings like this is
> that you need a way to turn them off, a new declaration that says
> "yes, this goal is pure, I really, really promise, cross my heart.
> Now please don't warn me about this."

They could make the warning go away by replacing the goal with "true",
which would no doubt improve their program.  ;-)

Failing that, a compiler option would suffice (like `--no-warn-simple-code',
etc.)

Cheers,
Mark.

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



More information about the reviews mailing list