[m-rev.] diff: reset contains_trace_goal if necessary
Peter Schachte
schachte at csse.unimelb.edu.au
Thu Nov 9 16:59:27 AEDT 2006
On Thu, Nov 09, 2006 at 04:10:41PM +1100, Mark Brown wrote:
> > 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.
*Any* promise might be wrong, and the consequences could be pretty
confusing. I don't think by itself that's a good enough reason for a
warning.
You could warn about redundant goals in general, but you'd have to
restrict the conditions pretty severely to avoid unwelcome warnings.
It would have to be something like what Ralph said: a det goal with
no outputs. It would also have to be redundant in every mode (you
don't want to get a warning for one mode of a clause complaining about
the redundancy of a goal that's necessary in another mode). And the
goal would have to appear in the clause as written by the programmer,
not be the result of inlining or other optimizations. And you
shouldn't get the warning if you're using mode inference.
But I still don't think such a warning should be on by default. I
can't see it catching many errors, and I can imagine wanting to write
redundant goals for clarity or because I'm planning to change the code
later so that it wouldn't be redundant (though I can't think of a
specific example). And I don't like the idea that removing an unused
mode declaration for a working predicate would cause the compiler to
start warning about another mode.
--
Peter Schachte There never has been, nor will there ever be,
schachte at cs.mu.OZ.AU any programming language in which it is the
www.cs.mu.oz.au/~schachte/ least bit difficult to write bad code.
Phone: +61 3 8344 1338 -- Lawrence Flon
--------------------------------------------------------------------------
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