[mercury-users] Puzzled about about I/O in predicates which may fail
Julien Fischer
juliensf at cs.mu.OZ.AU
Wed Nov 24 13:55:19 AEDT 2004
On Wed, 23 Nov 2004, Gregory D. Weber wrote:
> It seems to me that by using state variables, I can "fix" an
> error involving I/O in predicates which may fail.
> If read_problem_decl_semidet is indeed semidet, then
>
> (EXAMPLE 1)
>
> main(!IO) :-
> (
> read_problem_decl_semidet("credit.decl", Problem, !IO) ->
> describe_problem(Problem, !IO)
> ;
> io__print("Error reading file\n", !IO)
> ).
>
> compiles without any error message. Moreover, running the program
> actually works!
>
This is a bug in the compiler. Using the IO state in the condition of an
if-then-else should always be an error but the current compiler only
detects it sometimes.
Cheers,
Julien.
--------------------------------------------------------------------------
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