From wdunlap at tibco.com  Tue May  9 23:06:09 2017
From: wdunlap at tibco.com (William Dunlap)
Date: Tue, 9 May 2017 14:06:09 -0700
Subject: [Rd] R-3.3.3/R-3.4.0 change in sys.call(sys.parent())
Message-ID: <CAF8bMcZm2EvJLTUH6x51Fxi+HQyHD0zBMKTfTOsvQfnVtDKBGw@mail.gmail.com>

Some formula methods for S3 generic functions use the idiom
    returnValue$call <- sys.call(sys.parent())
to show how to recreate the returned object or to use as a label on a
plot.  It is often followed by
     returnValue$call[[1]] <- quote(myName)
E.g., I see it in packages "latticeExtra" and "leaps", and I suspect it
used in "lattice" as well.

This idiom has not done good things for quite a while (ever?) but I noticed
while running tests that it acts differently in R-3.4.0 than in R-3.3.3.
Neither the old or new behavior is nice.  E.g., in R-3.3.3 we get

> parseEval <- function(text, envir) eval(parse(text=text), envir=envir)
> parseEval('lattice::xyplot(mpg~hp, data=datasets::mtcars)$call',
envir=new.env())
xyplot(expr, envir, enclos)

and

> evalInEnvir <- function(call, envir) eval(call, envir=envir)
> evalInEnvir(quote(lattice::xyplot(mpg~hp, data=datasets::mtcars)$call),
envir=new.env())
xyplot(expr, envir, enclos)

while in R-3.4.0 we get
> parseEval <- function(text, envir) eval(parse(text=text), envir=envir)
> parseEval('lattice::xyplot(mpg~hp, data=datasets::mtcars)$call',
envir=new.env())
xyplot(parse(text = text), envir = envir)

and

> evalInEnvir <- function(call, envir) eval(call, envir=envir)
> evalInEnvir(quote(lattice::xyplot(mpg~hp, data=datasets::mtcars)$call),
envir=new.env())
xyplot(call, envir = envir)

Should these packages be be fixed up to use just sys.call()?

Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]



[Rd] R-3.3.3/R-3.4.0 change in sys.call(sys.parent())
William Dunlap