Skip to content

How to understand packages, namespaces, environments

4 messages · Mark Bravington, Gabor Grothendieck, Brian Ripley +1 more

#
[Alexander Stoddard]
[Duncan Murdoch]
That's interesting-- I thought there really were two copies. In my debug
package, I've taken the approach of changing both copies. Is one of the
copies a "master", and the other one something like an activeBinding?
Can I get away with changing just one of them?

Mark Bravington
#
On 5/8/05, Mark.Bravington@csiro.au <Mark.Bravington@csiro.au> wrote:
How does one refer to the two different copies? Thanks.
#
On Mon, 9 May 2005 Mark.Bravington@csiro.au wrote:

            
Duncan is wrong here (or misquoted).  Loading a package with a namespace 
loads all the objects in the package (possibly as promises) into the 
namespace environment.  Then some are copied (using assign) to the package 
environment.  Since like most R copies this is really copy-on-change you 
do not get a real copy (nor force a promise) until use.

See ?fixInNamespace for explicit statements about this.  There can be more 
than two copies, since importing also `copies', as does S3 method 
registration (the latter does sometimes force promises).
#
Prof Brian Ripley wrote:
Wrong, not misquoted.  Sorry about that.  Thanks for the correct 
description.

Duncan Murdoch