[m-dev.] proposal for promise_pure scope warning

Peter Schachte schachte at csse.unimelb.edu.au
Tue Apr 15 13:40:45 AEST 2008


Ian MacLarty wrote:
> On Tue, Apr 15, 2008 at 9:26 AM, Peter Schachte
>>  Isn't it possible for one particular call to a generally impure predicate
>> to be pure?  Eg, with that particular argument list, it's pure.
>>
> 
> I suppose so, but is this a good enough reason not to issue a warning?
>  I've come across bugs where this warning would have helped twice now.

I guess this is what I don't understand.  How could you accidentally wrap a 
promise_pure around a goal?  Hang on, is this because promise_pure is an 
operator that binds too tightly, so users think they've promised a sequence 
of goals to be pure when they've only promised a singlg goal?  If it's that, 
then maybe changing the precedence would be better.

> Most of the warnings issued by the compiler have cases where they
> don't apply (consider for example too lax determinism warnings).  We
> still issue them, because often they are helpful. In the cases where
> the warning is inappropriate we usually either change the code or
> disable the warning if changing the code is not possible.

If you're going to issue a warning for something that may be correct, there 
should be a low-nuisance way to disable the warning just for that occurrence. 
    Like beginning a variable name with _ to disable the singleton warning. 
How would you do it for this warning?  I hope it's not to conjoin it with a 
'true' goal so it won't be a single goal....

-- 
Peter Schachte              It is the function of the citizen to keep the
schachte at cs.mu.OZ.AU        Government from falling into error.
www.cs.mu.oz.au/~schachte/      -- Robert H. Jackson
Phone: +61 3 8344 1338
--------------------------------------------------------------------------
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