[m-rev.] for review: emit errors about purity mismatches with foreign clauses

Ian MacLarty maclarty at cs.mu.OZ.AU
Thu Jul 6 14:02:49 AEST 2006


On Thu, Jul 06, 2006 at 12:13:59PM +1000, Julien Fischer wrote:
> 
> > Actually there seems to be another bug because while the compiler reports a
> > warning, it doesn't generate an executable and a non-zero exit status is
> > returned (even with --no-halt-at-warn).  Try compiling the following program
> > to see what I mean:
> >
> > :- module pure.
> >
> > :- interface.
> >
> > :- import_module io.
> >
> > :- pred main(io::di, io::uo) is det.
> >
> > :- implementation.
> >
> > main(!IO) :-
> >         nl(!IO).
> >
> > :- pragma promise_pure(p/0).
> >
> > :- impure pred p is det.
> >
> > :- pragma foreign_proc("C",
> >         p,
> >         [will_not_call_mercury],
> > "
> >         printf(\"hello\");
> > ").
> 
> That is a purity error.
> 

Why does the compiler emit a warning then?

Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list