From t@r@@@z@kh@rko @end|ng |rom uzh@ch  Fri Feb 10 17:00:44 2023
From: t@r@@@z@kh@rko @end|ng |rom uzh@ch (Taras Zakharko)
Date: Fri, 10 Feb 2023 17:00:44 +0100
Subject: [Rd] A delayedAssign() variant for quoted expressions
Message-ID: <DF104F0E-5EF2-4014-976C-2CD9B0AE8EB6@uzh.ch>

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]]



[Rd] A delayedAssign() variant for quoted expressions
Taras Zakharko