From wdunlap at tibco.com  Wed Apr 20 20:58:47 2016
From: wdunlap at tibco.com (William Dunlap)
Date: Wed, 20 Apr 2016 11:58:47 -0700
Subject: [Rd] locked environments
Message-ID: <CAF8bMcbzg21p50PAHdFoicrGSWcY6P0=LXHRmLN8huNjGUmCbw@mail.gmail.com>

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]]



[Rd] locked environments
William Dunlap