[m-dev.] proposal for promise_pure scope warning

Ian MacLarty maclarty at csse.unimelb.edu.au
Tue Apr 15 14:33:09 AEST 2008

On Tue, Apr 15, 2008 at 02:11:36PM +1000, Julien Fischer wrote:
> On Tue, 15 Apr 2008, Peter Schachte wrote:
>> Julien Fischer wrote:
>>> I think you only want to emit a warning for promise_pure scopes around
>>> impure goals that do not have any outputs and have determinism det or
>>> cc_multi however.
>> That's a lot clearer:  the promise really looks like it must be a lie.  
>> The warning could ask the user to plug in their polygraph equipment into 
>> the USB port and prepare to answer a series of questions.  But the promise 
>> still might be correct.  The code might destructively modify some data 
>> structure in an equivalence-preserving way, eg caching the result of a 
>> computation.
> The problem here is that (some) Mercury programmers have a tendency to
> try to promise impurity away ASAP rather than thinking about where the
> correct place to do so is.  I don't think adding any number of new
> warning options is going to fix this.

It would have fixed the two cases I came across recently (i.e. the
bug in benchmarking.m as well as a similar example in some MC code).

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