In R, we can use makeActiveBinding to create an active binding by providing a function:
e <- new.env() makeActiveBinding("var", function(x) if (missing(x)) cat("get\n") else cat("set\n"), e)
Once the active binding is created, it seems there is no way to get the function behind it.
I wonder if it is possible to get a function behind an active binding, as shown below?
> getActiveBindingFunction("var", e) function(x) if (missing(x)) cat("get\n") else cat("set\n"), e)
source share