Taras Zakharko
2023-Feb-10 16:00 UTC
[Rd] A delayedAssign() variant for quoted expressions
It is sometimes useful to create a promise using a constructed expression, but delayedAssign will always substitute the expression argument. I am currently using this pattern to achieve this: expr <- bquote(?) eval(call("delayedAssign", x, expr, eval.env = eval_env)) But it would be nice if base R already had a function that takes quoted promise body. It could be named delayedAssign0 or delayedAssignq (similar to evalq). The definition of such function would be trivial (just remove substitute from delayedAssign): function (x, value, eval.env = parent.frame(1), assign.env = parent.frame(1)) .Internal(delayedAssign(x, substitute(value), eval.env, assign.env)) Maybe R maintainers could consider adding this function? I would be happy to submit a patch. Best, Taras [[alternative HTML version deleted]]