[m-dev.] trace goals and reordering
Julien Fischer
jfischer at opturion.com
Thu May 1 12:18:22 AEST 2025
Hi,
I was recently debugging an issue in one of our applications where some log
messages were emitted in an unexpected order. The log messages are generated by
calls inside trace goals and it turned out that one of the trace goals was
being reordered in order to be mode correct. The attached program is a very
simplified example of this.
The reference manual says the following about trace goals:
The compiler will not delete trace goals from the bodies of the procedures
containing them, even though they are 'det' and have no outputs. In their
effect on program optimizations, trace goals function as a kind of
impure code,
but one with an implicit promise_pure around the clause in which they occur
This seems a bit vague. What is meant by "kind of impure code"? At least as
far as reordering due to modes is concerned, the implementation does not seem
to treat them as impure. Is that intentional? (If so, I think the reference
manual should mention the possibility that they can be reordered for
mode correctness.)
Julien.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tg_reorder.m
Type: application/octet-stream
Size: 1051 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20250501/e6faf537/attachment.obj>
More information about the developers
mailing list