Skip to content
Prev 2901 / 12125 Next

[R-pkg-devel] Puzzled about "locked environments".

On 07/08/2018 07:23 PM, Duncan Murdoch wrote:
AssetPricing does, at least some of the time, in the body of a function 
(the indentation is confusing)

environment(vupdate) <- new.env()
environment(scrG) <- new.env()
environment(initx) <- new.env()
environment(cev) <- new.env()

#
     assign("dS",dS,envir=environment(vupdate))
     assign("dS",dS,envir=environment(scrG))
     assign("dS",dS,envir=environment(initx))
     assign("dS",dS,envir=environment(cev))

so that assignment is to the unlocked new.env(). Presumably the new code 
assigns to bar's original environment, which is the (locked, once the 
package is loaded) package name space.

Martin Morgan
This email message may contain legally privileged and/or...{{dropped:2}}