2024-07-15 10:03 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000143mercuryBugpublic2010-05-20 19:02
Assigned Tojuliensf 
Product Version 
Target VersionFixed in Version 
Summary0000143: ':- initialise' directives not being respected.
DescriptionCompile 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.
TagsNo tags attached.
Attached Files
  • ? file icon foo.m (984 bytes) 2010-04-09 17:29




juliensf (administrator)

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.


juliensf (administrator)


-Issue History
Date Modified Username Field Change
2010-04-09 17:29 rafe New Issue
2010-04-09 17:29 rafe 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
+Issue History