[m-dev.] from [mercury-users] Re: Question regarding determinism
Andrew Bromage
bromage at cs.mu.OZ.AU
Fri Sep 11 18:15:23 AEST 1998
G'day all.
Fergus Henderson wrote:
> There are other cases where making determinism analysis smarter would help.
> For example, if the user writes
>
> :- mode t(in, out).
> t(X, O) :-
> p(X, Y), % outputs `Y'
> ( q(Y, Z), r(Z) ), % outputs only `Z', which is local
> s(O). % outputs `O'.
>
> then they might expect that the explicit parentheses would be enough
> to ensure that the compiler will prune the goal in parentheses.
> But currently that isn't the case.
The main problem that I have a problem with making determinism analysis
smarter is that it makes the determinism analysis more complex.
Determinism analysis currently has the benefit of being a nice, simple
bottom-up analysis. I'd much prefer to keep it like that, if only to
make it easier on the next Mercury implementation.
I think the case above is a Prolog syntax bug. Conjunctions should nest
as the programmer stated they'd nest rather than as Prolog parses them.
Of course, it could be argued that the programmer should be obliged to
write it as some [Z] (q, r) if they want a better determinism.
Cheers,
Andrew Bromage
More information about the developers
mailing list