[m-dev.] Why no automatic initialization?

Ralph Becket rafe at cs.mu.OZ.AU
Fri Mar 10 10:33:43 AEDT 2006


Peter Schachte, Thursday,  9 March 2006:
> Hi all,
> 
> For this bit of code:
> 
> 	sendmoney(Values):-
> 	        Vs = [S, E, N, D, M, O, R, Y],
> 		any_list.map0(between(0,9), Vs),
> 	        all_different(Vs),
> 	        fd_exclude_value(S, 0),
> 	        fd_exclude_value(M, 0),
> 	        linear_eq(
> 			[-1, 10, -900, -9000, 1, -90, 91, 1000],
> 			[ Y, R, O, M, D, N, E, S],
> 			0),
> 	        label(Vs),
> 		Values = map(value, Vs).
> 
> I get this error from the Mercury compiler:
> 
> 	sendmoney.m:030: In clause for `sendmoney(out)':
> 	sendmoney.m:030:   in argument 2 of functor `[|]/2':
> 	sendmoney.m:030:  mode error in unification of `V_12' and `list.[E |
> 	V_13]'.
> 	sendmoney.m:030:   Variable `V_12' has instantiatedness `free',
> 	sendmoney.m:030:  term `list.[E | V_13]' has instantiatedness
> 	`list.'[|]'(
> 	sendmoney.m:030:     free,
> 	sendmoney.m:030:     free
> 	sendmoney.m:030:   )'.
> 
> Why didn't the compiler insert a call to the initialization predicate
> for each element of this list?  (Line 30 is the Vs = [S, .... line).

Hmm... looks like a compiler bug to me.  I'll look into it.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list