[R] .BaseNamespaceEnv locking in non-interactive mode

Benjamin Tyner btyner @end|ng |rom gm@||@com
Wed Nov 23 16:41:39 CET 2022


Greetings,

Noticed that starting with R version 4.1.0, the base environment is 
locked by default. So for example in interactive mode, we have

 > .BaseNamespaceEnv$foo <- "bar"
Error in .BaseNamespaceEnv$foo <- "bar" :
   cannot add binding of 'foo' to the base environment

However it appears that when operating in non-interactive mode, the 
locking is not actually enforced:

$ ~/R422/bin/Rscript -e "environmentIsLocked(.BaseNamespaceEnv)"
[1] TRUE

$ ~/R422/bin/Rscript -e ".BaseNamespaceEnv$foo <- 'bar'; 
.BaseNamespaceEnv$foo"
[1] "bar"

Just wondering if this is intentional, and if not, should I file a bug 
report?

Regards,

Ben



More information about the R-help mailing list