When condition is created, allow for a test() function to be included.
Users can then do something like:
my_condition <- condition(..., test = function(x, y) x > 1)
my_condition$test(x, y, ...))
Which, when TRUE, will pass ... to $message().
Or something like browser(expr = )a
Replaces
if (test()) {
cnd(condition(...))
}
... would expr be evaluated in the parent frame?
# test would then be quoted?
my_condition <- condition(..., test = x != y)
foo <- function(x, y) {
my_condition$test()
}
foo <- function(expr) {
expr <- substitute(expr)
function() list(foo = eval(expr, parent.frame(1)))
}
bar <- foo(x > 1)
fizz <- function(x) {
bar()
}
fizz(1)
#> $foo
#> [1] FALSE
fizz(2)
#> $foo
#> [1] TRUE
When
conditionis created, allow for atest()function to be included.Users can then do something like:
Which, when
TRUE, will pass...to$message().Or something like
browser(expr = )aReplaces
... would
exprbe evaluated in the parent frame?