STR-733: Dynamic Rule problem with :+ operator, when only using side-effects
We are working on an extension mechanism for WebDSL and I came across a but (hopefully it’s really a bug this time). I included the code as an attachment. The expected output of this program is:
Initialized rule1 dyn-rule.
Initialized rule2 dyn-rule.
Running rule2!
Running rule1!But the actual output is:
Initialized rule1 dyn-rule.
Initialized rule2 dyn-rule.
Running rule1!
Running rule1!Which means that rule1 is called twice for some unknown reason. Interestingly this can be “fixed” by using the magic-fix rule, which is defined as follows:
magic-fix = id
If you apply this rule to either rules( RunAllRules :+ t -> [] where t ) or rules( RunAllRules :+ t -> [] where t ) like so: rules( RunAllRules :+ t -> [] where <magic-fix; rule1> t ) on ONE of these cases (but not both), then it work again.
Submitted on 10 January 2008 at 10:36
Log in to post comments