dont.lockBindings: Helper for live-editing of packages

Description Usage Arguments Details See Also Examples

Description

Normally, objects in a NAMESPACEd package are locked and can't be changed. Sometimes this isn't what you want; you can prevent it by calling dont.lockBindings in the .onLoad for the package. For user-visible objects (i.e. things that end up in the "package:blah" environment on the search path), you can achieve the same effect by calling dont.lockBindings in the package's .onAttach function, with namespace=FALSE.

Usage

1
 dont.lockBindings( what, pkgname, namespace.=TRUE)

Arguments

what

(character) the names of the objects to not lock.

pkgname

(string) the name of the package. As you will only use this inside .onLoad, you can just set this to pkgname which is an argument of .onLoad.

namespace.

TRUE to antilock in the namespace during .onLoad; FALSE to antilock in the visible manifestation of the package.

Details

Locking occurs after .onLoad / .onAttach are called so, to circumvent it, dont.lockBindings creates a hook function to be called after the locking step.

See Also

lockBinding, setHook

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
library( debug)
debug:::.onLoad # d.lB is called to make 'tracees' editable inside 'debug's namespace.
debug:::.onAttach # d.lB is called to make 'tracees' editable in the search path
# NB also that an active binding is used to ensure that the 'tracees' object in the search...
#... path is a "shadow of" or "pointer to" the one in 'debug's namespace; the two cannot get...
#... out-of-synch

## End(Not run)

mvbutils documentation built on May 2, 2019, 8:32 a.m.