-
Say I have two modules, call them
foo <- function(...) {
box::use(Y[bar])
bar(...)
} Is it possible (without redefining box::use(./X)
box::use(./Y)
unlockBinding(as.name("bar"), Y)
Y$bar <- Y$baz
X$foo() # I want this to use the version of Y$bar that was copied from Y$baz The naive approach above isn't working, I suspect because of the lazy caching mechanism in box? I realize this kind of "hot swapping" is not a best practice, but I'm curious to learn what would be involved in making it work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Okay, here is one rough approach: Y.env <- box::topenv(Y)
unlockBinding(as.name("bar"), Y.env)
Y.env$bar <- Y.env$baz Note: |
Beta Was this translation helpful? Give feedback.
Okay, here is one rough approach:
Note:
topenv
was newly added in version 1.1.3.