unload {box}R Documentation

Unload or reload a given module

Description

Unload a given module or reload it from its source.

Usage

unload(mod)

reload(mod)

Arguments

mod

the module reference to be unloaded or reloaded

Details

Unloading a module causes it to be purged from the internal cache such that the next subsequent box::use declaration will reload the module from its source. reload is a shortcut for unloading a module and calling box::use in the same scope with the same parameters as the box::use call that originally loaded the current module instance.

Value

box::unload and box::reload are called for their side-effect. They do not return anything.

Note

Any other references to the loaded modules remain unchanged, and will still work. Unloading and reloading modules is primarily useful for testing during development, and should not be used in production code.

unload and reload come with a few restrictions. unload attempts to detach names attached by the corresponding box::use call. reload attempts to re-attach these same names. This only works if the corresponding box::use declaration is located in the same scope.

reload will re-execute the .on_load hook of the module.

See Also

use, mod-hooks


[Package box version 1.0.2 Index]