[Rd] Changes to environments in R-devel
murdoch at stats.uwo.ca
Fri Nov 4 01:55:42 CET 2005
I've just committed some changes to R-devel which affect environments.
- using NULL as an environment is now deprecated: use baseenv()
instead. (baseenv() is already available in R 2.2.0, where it returns
NULL. For most purposes it retains the same meaning in R-devel.) If you
do use NULL, it will be converted to baseenv(), and a warning printed.
> f <- function(x) 1
> environment(f) <- NULL
use of NULL environment is deprecated
There may be some places where I've missed putting the conversion in
place, and use of NULL will cause an error; please let me know if you
find any of those. The intention is that NULL will be usable with
warnings through to the end of the 2.3.x releases.
- baseenv() is no longer its own parent. Its parent is an empty
environment, available as emptyenv().
- You can now create your own environment with emptyenv() as its
parent. Searches for variables in such an environment will not
automatically proceed to baseenv(), as searches do in current R releases.
More information about the R-devel