[m-dev.] use of require/1 and mode error?

Fergus Henderson fjh at cs.mu.oz.au
Mon Sep 15 02:47:14 AEST 1997


Christopher Rodd SPEIRS, you wrote:
> > clpr/samples/laplace.m:
> > 	Use an if-then-else rather than require/1, because the use
> > 	of require/1 is a mode error. 
> > 	(XXX the compiler doesn't yet detect the error.)
> >  
> > -	% XXX use of `require' is a bug (should be a mode error)
> > -	{ require(laplace(X), "laplace failed\n") },
> 
> Why is the use of require a mode error?  Is the use of require always a
> mode error, or is there something special about this case?

A higher-order term (such as the first argument to require/1)
is not allowed to have any partially applied output arguments,
because (a) it might be called any number of times, and (b)
it might be called inside negations.  But laplace(X) does bind `X'.
(a) is not a problem for `any' insts, but (b) is, so it
should be an error.

-- 
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