fake_package("fake", list(
add2 = function(a, b) {
a + b
},
add4 = function(a, b, c, d) {
add2(a, b) + add2(c, d)
},
rec_factorial = function(x) {
if(x == 1) return(1)
x * rec_factorial(x-1)
}
))
rig_in_namespace(add2, add4, rec_factorial, print_args = TRUE)
# works
add4(1, 2, 3, 4)
# rigged functions calling themselves are not opened/closed right
add2(add2(1, 2), add2(3, 4))
# recursive calls of rigged functions are not opened/closed right
rec_factorial(2)
Because of the way we store
..FIRST_CALL..and..EVALED_ARGS..in the mask.works :
doesn't :
doesn't either:
I believe the mask might contain a variable
..STATE..that would be a list, the first call of a rigged function would add an item to that list, and set up that it would be peeled off on exit (withwithr::defer_parentas done atm). thenwrap()ped functions would look at the last item.