Skip to content
Prev 55066 / 63424 Next

odd assignInNamespace / setGeneric interaction

The problem is not specific to redefining the q function, but to
the interaction of assignInNamespace and setGeneric.  The
latter requires, roughtly, that the environment of the function
being replaced by an S4 generic is (or is the descendent of)
the environment in which it lives.

E.g., the following demonstrates the problem

% R --quiet --vanilla
getNamespace("graphics"))
Error: package or namespace load failed for ?stats4? in loadNamespace(name):
 there is no package called ?.GlobalEnv?

and defining the bogus plot function in the graphics namespace avoids the
problem

% R --quiet --vanilla
...) stop("No plotting allowed!")), getNamespace("graphics"))
I suppose poeple who use assignInNamespace get what they deserve.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Apr 19, 2018 at 2:33 AM, Martin Maechler <maechler at stat.math.ethz.ch