[m-dev.] proposal for promise_pure scope warning

Ian MacLarty maclarty at csse.unimelb.edu.au
Tue Apr 15 12:46:28 AEST 2008

On Tue, Apr 15, 2008 at 9:26 AM, Peter Schachte
<schachte at csse.unimelb.edu.au> wrote:
> >
> > >  Well, either the author of the called predicate made it impure for a
> > >  reason, in which case you shouldn't be promising that a call to the
> > >  predicate is pure, or the author made a mistake and the predicate is
> > >  actually pure, in which case it is the author's responsibility to
> > >  fix the interface.  In any case the warning can always be disabled.
> > >
> >
>  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.

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.

I think the warning I'm proposing would be useful enough to be worth
the slight inconvenience caused when it's not applicable.

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