[Rd] Quirk with as.function(..., envir = NULL) and body(...,
	envir = NULL) <-
    Duncan Murdoch 
    murdoch at stats.uwo.ca
       
    Fri Mar 11 13:39:38 CET 2005
    
    
  
I've been doing some looking through the environment code lately, and
noticed that both as.function(..., envir = NULL) and body(..., envir =
NULL)<- treat the NULL as .GlobalEnv, even though NULL is the
environment of the base package.
The code that does this is very deep in the guts of R and affects all
sorts of things, so I'm not planning to change it for 2.1.0, but I
expect it will be fixed in 2.2.0 this fall.
In the meantime, I'd advise people to avoid using envir = NULL, and
instead use envir = globalenv() or envir = .GlobalEnv (which are
equivalent).  
If you want to set base as the environment for a function, you should
use
environment(f) <- NULL
for now. 
Duncan Murdoch
    
    
More information about the R-devel
mailing list