[Rd] A doubt about substitute() after delayedAssign()

From: Philippe Grosjean <phgrosjean_at_sciviews.org>
Date: Sun, 29 Apr 2012 09:30:51 +0200


Hello,

?delayedAssign presents substitute() as a way to look at the expression in the promise. However,

msg <- "old"
delayedAssign("x", msg)
msg <- "new!"
x #- new!
substitute(x) #- x (was 'msg' ?)

Here, we just got 'x'... shouldn't we got 'msg'?

Same result when the promise is not evaluated yet:

delayedAssign("x", msg)
substitute(x)

In a function, that works:

foo <- function (x = msg) substitute(x)
foo()

Did I misunderstood something? It seems to me that substitute() does not behaves as documented for promises created using delayedAssign(). Best,

Philippe

-- 

..............................................<}))><........
) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( ( Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .............................................................. ______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun 29 Apr 2012 - 07:34:28 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 29 Apr 2012 - 14:30:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive