[mercury-users] State variable problem

Nicholas Nethercote njn at csse.unimelb.edu.au
Wed May 31 00:02:27 AEST 2006


Hi,

I have this snippet of code:

   type_of(app(Name, Args), app(Name, NArgs), Pos, GSyms, LSyms, !Errs) = T :-
       T = type_of_app(call, Name, Args, NArgs, Pos, GSyms, LSyms, !Errs).

The details aren't important, other than it's using state variable syntax.

I get this error message about it:

   typecheck.m:918: In clause for function `typecheck.type_of/7':
   typecheck.m:918:   warning: variable `Errs' occurs only once in this scope.

I don't see what the problem is.  But if I replace the "!Errs" in the call 
with "!.Errs, !:Errs", viz:

   type_of(app(Name, Args), app(Name, NArgs), Pos, GSyms, LSyms, !Errs) = T :-
     T = type_of_app(call, Name, Args, NArgs, Pos, GSyms, LSyms, !.Errs, !:Errs).

I don't get the error.

Any ideas what is going on?  I'm stumped.

Thanks.

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