Ideally they should all work. What is happening is that the current implementation of complex assignment wants to use a temporary variable named *tmp*, which it can't when the evaluation environment is locked. Assignments in compiled code use a different mechanism that I hope will eventually be ported to the interpreter. Then these should all work.
Best, luke On Wed, 20 Apr 2016, William Dunlap via R-devel wrote:
Shouldn't the following 4 ways to alter an object in a locked environment either all work or all fail? (All working would be nice, I think.) E <- new.env() assign("var", c(1,2,3,4), envir=E) lockEnvironment(E, bindings=FALSE) E$var[1] <- 101 ; E$var #[1] 101 2 3 local(var[2] <- 102, envir=E) #Error in eval(expr, envir, enclos) : # cannot add bindings to a locked environment with(E, var[3] <- 103) #Error in eval(expr, envir, enclos) : # cannot add bindings to a locked environment eval(quote(var[4] <- 104), envir=E) #Error in eval(expr, envir, enclos) : # cannot add bindings to a locked environment get("var", envir=E) #[1] 101 2 3 4 Bill Dunlap TIBCO Software wdunlap tibco.com [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
-- Luke Tierney Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke-tier...@uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel