[mercury-users] determinism declaration not satisfied
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Jul 12 08:00:47 AEST 2001
On 11-Jul-2001, Terrence Brannon <tmbranno at oracle.com> wrote:
>
> border.m:007: In `main(di, uo)':
> border.m:007: error: determinism declaration not satisfied.
> border.m:007: Declared `cc_multi', inferred `cc_nondet'.
> border.m:013: call to `border(in, out)' can fail.
That error message seems pretty clear to me.
The compiler thinks the call to border/2 can fail,
but main/2 is not allowed to fail.
> :- pred main(io__state::di, io__state::uo) is cc_multi.
...
> main -->
> { border("sussex",L) }, io__write_string(L).
Suppose this string was "foo" rather than "sussex".
What would you expect your program to output?
Note that if you give declarations for your procedures,
the compiler's determinism analysis won't look at the clauses
of the called procedures, it will just base its analysis on
the declared determinism:
> :- pred border(string, string).
> :- mode border(in, out) is nondet.
> :- mode border(out, in) is nondet.
For some suggestions on how you can rewrite the program to avoid
the error, see the section "Replacing compile-time checking with
run-time checking" in the Determinism chapter of the l
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list