|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000143||mercury||Bug||public||2010-04-09 17:29||2010-05-20 19:02|
|Target Version||Fixed in Version|
|Summary||0000143: ':- initialise' directives not being respected.|
|Description||Compile the attached foo.m file and run it. It should output|
map([(1 -> BAZ), (2 -> BAR), (3 -> BAZ)])
but unless the call to init_foo/2 in main/2 is uncommented out you get this:
map([(1 -> baz), (2 -> bar), (3 -> baz)])
The ':- initialise init_foo/2.' directive is not being respected.
This is a problem since I was hoping to use this functionality to debug the IC solver.
|Tags||No tags attached.|
This is not a bug IMO. The initialiser is being called, you can see this if you get it to print something
out. The problem is that the pretty-printer stores its state in a set of mutables
From section 9.6 of the reference manual:
For the purposes of determining when mutables are assigned their initial values, the expression ‘initial_value’ behaves as though it were a predicate specified in an ‘initialise’ directive.
From section 9.4 of the reference manual:
Initialisation predicates within a module are executed in the order in which they are specified, although no order may be assumed between different modules or sub-modules.
What is happening here, is that your initialiser is being called and the its effects are being
overwritten by the initialisation of the mutables in the pretty_printer module in the stdlib.
||File Added: foo.m|
|2010-04-09 17:53||juliensf||Note Added: 0000262|
|2010-04-09 17:53||juliensf||Status||new => feedback|
|2010-05-20 19:02||juliensf||Note Added: 0000264|
|2010-05-20 19:02||juliensf||Status||feedback => resolved|
|2010-05-20 19:02||juliensf||Resolution||open => fixed|
|2010-05-20 19:02||juliensf||Assigned To||=> juliensf|