[m-dev.] For review: Fix inappropriate warning message for purity markers.

Fergus Henderson fjh at cs.mu.oz.au
Tue Jan 6 15:39:17 AEDT 1998


On 06-Jan-1998, Peter Schachte <pets at students.cs.mu.oz.au> wrote:
> On Sat, 13 Dec 1997, Fergus Henderson wrote:
> 
> > Does the code in prog_io_goal report an error for `impure call(P)',
> > as in the following example?
> > 
> > 	:- impure pred p(pred::(pred is semidet)) is semidet.
> > 	p(P) :- 
> > 		impure call(P).
> 
> The new test case:
> 
>    :- impure pred e14(pred).
>    :- mode e14((pred is semidet)) is semidet.
> 
>    e14(P) :- impure call(P).
> 
> gives these messages:
> 
>    purity_nonsense.m:018: Warning: unnecessary `impure' marker.
>    purity_nonsense.m:018:   Higher-order goals are always pure.
>    purity_nonsense.m:015: In predicate `purity_nonsense:e14/1':
>    purity_nonsense.m:015:   warning: declared `impure' but actually pure.
>    purity_nonsense.m:015: Error: no mode declaration for predicate `purity_nonsense:e14/1'.
> 
> Is that good enough?

Yes, that's fine, except for that bogus error message at the end.

> I don't know where the last message came from, any idea?

Nope.

> Is it acceptable?

Not really.

> On the subject of bogus error messages, the code:
> 
>    e12 :- impure (\+ impure imp).
> 
> Gives this explosion of nonsense:
> 
>    purity_nonsense.m:012: In clause for predicate `purity_nonsense:e12/0':
>    purity_nonsense.m:012:   in argument 1 of call to predicate `impure/1':
>    purity_nonsense.m:012:   error: the language construct \+/1 should be
>    purity_nonsense.m:012:   used as a goal, not as an expression.
>    purity_nonsense.m:012: In clause for predicate `purity_nonsense:e12/0':
>    purity_nonsense.m:012:   in argument 1 of call to predicate `impure/1':
>    purity_nonsense.m:012:   in argument 1 of functor `\+/1':
>    purity_nonsense.m:012:   error: the language construct impure/1 should be
>    purity_nonsense.m:012:   used as a goal, not as an expression.
>    purity_nonsense.m:012: In clause for predicate `purity_nonsense:e12/0':
>    purity_nonsense.m:012:   in argument 1 of call to predicate `impure/1':
>    purity_nonsense.m:012:   in argument 1 of functor `\+/1':
>    purity_nonsense.m:012:   in argument 1 of functor `impure/1':
>    purity_nonsense.m:012:   error: undefined symbol `imp/0'.
>    purity_nonsense.m:012: In clause for predicate `purity_nonsense:e12/0':
>    purity_nonsense.m:012:   error: `impure' marker in an inappropriate place.
> 
> It gets to the point at the end, but everything up to that is just
> confusing.  I have no idea how to fix this.

Yes, I agree that a fix is hard.  That will have to do, at least for
the time being.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list