[m-dev.] Re: proposal: user-defined equality predicates

Fergus Henderson fjh at cs.mu.oz.au
Fri Jun 27 16:33:16 AEST 1997


Andrew Bromage, you wrote:
> As I pointed out in a message which I just sent off, the current
> compiler accepts this:
> 
> :- func f(int) = int is cc_multi.

That is a bug.  Two bugs actually.

Bug #1 is that in declarations like the above, it silently ignores the
determinism.  What it ought to do is to report a syntax error.
Well, it is arguable that this syntax should be allowed, but currently
it is not.  You are supposed to write this as

:- func f(int::in) = (int::out) is cc_multi.

Or as

:- func f(int) = int.
:- mode f(in) = out is cc_multi.

If you write that, then the compiler will correctly report
that the other part of your code

> :- func g(int) = int is det.
> g(X) = f(X).

has a determinism error.

Bug #2 is that although functions are not allowed to be `cc_multi' in their
forward mode, the compiler currently does not check this.  This is also
not really documented.

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