-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
When compiling a function which takes as an argument a promise that changes the environment, the environment that is being changed is the incorrect one.
Runnning the following example with PIR_WARMUP=3 PIR_OSR=0
f <- function(x) {
x + x
}
h <- function() {
assign("x", 1L, sys.frame(-2))
42
}
for (i in 1:15) {
i <- f(h())
print(i)
}the printed number should be 43, but after compilation it is 84.
After that, if x is accessed from the top level, it returns 1.
Therefore, the environment that is being modified is not the callee (f), but the global environment.
Reactions are currently unavailable