[m-users.] Compiler bug found

Volker Wysk post at volker-wysk.de
Fri Feb 24 02:08:02 AEDT 2023


Hi!

I get a compiler error with this piece of code:


:- pred main1(io::di, io::uo) is det.

main1(!IO) :-
    io.write_string("Parent\n", !IO),
    spawn_ex(yes, "echo", ["Hallo", "Welt"], _Pid, !IO),
    spawn_ex(no, "echo", ["Hallo", "Welt"], _Pid, !IO).


The error message is:


test.m:048: In `main1'(di, uo):
test.m:048:   error: determinism declaration not satisfied.
test.m:048:   Declared `cc_multi', inferred `semidet'.
test.m:048:   The reason for the difference is the following.
test.m:053:   In argument 4 of call to predicate `process.spawn_ex'/6:
test.m:053:   unification with `_Pid' can fail.
test.m:052: In clause for predicate `main1'/2:
test.m:052:   warning: variable `_Pid' occurs more than once in this scope.
test.m:053: In clause for predicate `main1'/2:
test.m:053:   warning: variable `_Pid' occurs more than once in this scope.


After changing the "_Pid" variables to "_", it works.

Cheers,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230223/b6382fc4/attachment.sig>


More information about the users mailing list