18.4 Interactive Module Loading
The racket/rerequire and racket/enter libraries provide support for loading, reloading, and using modules.
18.4.1 Entering Modules
(require racket/enter) | package: base |
syntax
(enter! module-path)
(enter! #f) (enter! module-path flag ...+)
flag = #:quiet | #:verbose-reload | #:verbose | #:dont-re-require-enter
The #:verbose, #:verbose-reload, and #:quiet flags correspond to 'all, 'reload, and 'none verbosity for dynamic-rerequire. The default corresponds to #:verbose-reload.
After switching namespaces to the designated module, enter! automatically requires racket/enter into the namespace, so that enter! can be used to switch namespaces again. In some cases, requiring racket/enter might not be desirable (e.g., in a tool that uses racket/enter); use the #:dont-re-require-enter flag to disable the require.
18.4.2 Loading and Reloading Modules
(require racket/rerequire) | package: base |
procedure
(dynamic-rerequire module-path [ #:verbosity verbosity]) → void? module-path : module-path? verbosity : (or/c 'all 'reload 'none) = 'reload
If invoking module-path requires loading any files, then modification dates of the files are recorded. If the file is modified, then a later dynamic-rerequire re-loads the module from source; see also Module Redeclarations. Similarly if a later dynamic-rerequire transitively requires a modified module, then the required module is re-loaded. Re-loading support works only for modules that are first loaded (either directly or indirectly through transitive requires) via dynamic-rerequire.
When enter! loads or re-loads a module from a file, it can print a message to (current-error-port), depending on verbosity: 'verbose prints a message for all loads and re-loads, 'reload prints a message only for re-loaded modules, and 'none disables printouts.