[m-dev.] for review: impure functions

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Apr 6 14:37:03 AEST 2000


On 05-Apr-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 05-Apr-2000, David Glen JEFFERY <dgj at cs.mu.OZ.AU> wrote:
> > > +	; { PurityCheckResult = no_impure_in_closure },
> > > +			% We catch this error at the creation of the closure
> > > +			% It might also make sense to flag missing
> > > +			% impurity declarations inside closures, but we
> > > +			% don't do so currently.
> > > +		{ NumErrors = NumErrors0 }
> > 
> > Do you mean that we don't give an error for a call to an impure pred without
> > an `impure' annotation inside a closure? If so, you should mark that with
> > an XXX at least.
> 
> We give an error,  it's just that we give an error about the entire closure
> being impure, not individual calls inside it.

Gotcha. That's fine, then.

> > I'm not sure that the language reference manual should talk about what warnings
> > the compiler should be expected to produce. (Unless there is a precedent
> > elsewhere in the manual that I wasn't aware of).
> 
> I'm open to suggestions on this one.  I mentioned it in the paper and
> just pasted this in.  
> 
> There certainly is precendent -- consider the documention for pragma
> obsolete.  This is a pragma whose purpose it to generate warnings.

True, but the whole pragmas section is presented as being implementation
dependent, so the rules can be bent a bit there.

I'm not too fussed either way, though.

> > > ===================================================================
> > > RCS file: purity_nonsense.err_exp
> > > diff -N purity_nonsense.err_exp
> > > --- /dev/null	Thu Mar  4 04:20:11 1999
> > > +++ purity_nonsense.err_exp	Wed Nov 10 09:40:13 1999
> > > @@ -0,0 +1,47 @@
> > 
> > This test case no longer looks right...
> 
> I'm not sure what you are talking about.  
> 
> If you are taling about purity_nonsense.m, then this is an old test
> case.  It tests putting the words "impure" or "semipure" into rather
> strange places.  The compiler should spit out lots of error messages.
> 
> The test is unchanged from the version that's been there for years.
> I just moved it into a subdir.

I was talking about the line:

:- impure func undefined_func = foo.           % no impure functions (yet)

which should now be legal.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list