[mercury-users] Possible state var / uniqueness bug Re: Request for comments on this code
Peter Moulder
Peter.Moulder at infotech.monash.edu.au
Mon Jul 10 17:37:28 AEST 2006
On Mon, Jul 10, 2006 at 04:18:59PM +1000, Julien Fischer wrote:
>
> On Mon, 10 Jul 2006, Peter Moulder wrote:
>
> > Is this a compiler bug? Or how should tst2.m be written such that it
> > uses state-variable syntax for its io vars, and has an I/O call as the
> > condition of an if-then-else?
>
> It's a compiler bug - you aren't supposed be allowed to do I/O in the
> condition of an if-then-else.
I don't see this restriction mentioned in (mercury_ref)Goals, or any of
the subsections of (mercury_ref)Unique modes. I suggest that these are
the obvious places to look for a person wondering "is this valid Mercury
code".
Furthermore, it isn't clear to me why it should be forbidden (except
perhaps for stylistic reasons, at least if an alternative like `&&'
existed). The compiler knows that the condition can't fail, so I
believe it's just a case of `CONDGOAL && THENGOAL', i.e. declaratively
equivalent to `CONDGOAL, THENGOAL'.
Btw, I haven't tested this code in current 0.13 betas; from memory,
Julien mentioned in a June 23 post to this list that these versions
include a fix for a mode analysis bug.
pjrm.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at csse.unimelb.edu.au
administrative address: owner-mercury-users at csse.unimelb.edu.au
unsubscribe: Address: mercury-users-request at csse.unimelb.edu.au Message: unsubscribe
subscribe: Address: mercury-users-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list