-
Notifications
You must be signed in to change notification settings - Fork 7
Description
With P seq Q the rule Q should behave like all updates from P were applied (Definition 4.1.1. on page 161 of the ASM Book).
Therefore I expect these two rules to have the same output:
rule Case1 =
if myNumbers = undef then {
myNumbers := {1, 2}
numberData(1) := "one"
numberData(2) := "two"
}
else
// "data: {one, two}"
print "data: " + map(myNumbers, @numberData)
rule Case2 =
seq {
myNumbers := {1, 2}
numberData(1) := "one"
numberData(2) := "two"
}
next
// "data: {undef}"
print "data: " + map(myNumbers, @numberData)
While the first case correctly prints "data: {one, two}" (in the second step) the second case prints "data: {undef}" (in the first step). More specifically I created test files for the map, filter and fold functions here: Locke@11b167e
I looked into the implementation a bit and it doesn't seem like a simple bug but more like a design problem of the map, filter and fold functions.
The interpreter correctly resolves both arguments myNumbers and @numberData through interpretExpressions -> frNode.getArguments -> getUnevaluatedNode. But then for example the method MapFunctionElement.getValue just calls getValue on the MapFunction of @numberData and not getValue on the storage - which should correctly load the value from the stack.