Re: [m-users.] Confused my det/multi error message, full disjunction of type in place.
Julien Fischer <[email protected]>
| Newsgroups | gmane.comp.lang.mercury.general |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 4 Dec 2022, Sean Charles (emacstheviking) wrote: > > > On 4 Dec 2022, at 10:50, Julien Fischer <[email protected]> wrote: > > On Sun, 4 Dec 2022, Sean Charles (emacstheviking) wrote: > > And the code, I just don't understand, as usual, what the compiler is > trying to tell me. The io.nl/2 is det, so that can't fail, and > presumably the field update can't fail either. And why hasn't this > error been raised on all the other cases? >    59 :- pred write_(fstate::in, fstate::out, fi::in, io::di, io::uo) is det. >    60 >    61 write_(!S, nl, !IO) :- >    62    io.nl(!IO), >    63   !:S = !.S ^nl_written := yes. >    64 >    65 write_(!S, brace_o, !IO) :- >    66   write_(!S, s("{"), !IO), >    67   !:S = !.S ^tab_size := !.S ^tab_size+1. > >                                                    ^^^ >    68   write_(!S, nl, !IO). > > > Presuambly, the period marked above is actually supposed to be a comma. > (Because it's a period, you have two clauses that match nl.) > > Why would it be a comma? I just don't understand, "!,S" ??? That's a syntax error surely? I meant the period at the end of the line -- my mail client mangled that a bit. (e.g. it should be: !:S = !.S ^tab_size := !.S ^tab_size+1, write_(!S, nl, !IO). ) Julien. _______________________________________________ users mailing list [email protected] https://lists.mercurylang.org/listinfo/users