3.26 Importing Modules Lazily: lazy-require
(lazy-require [module-path (fun-import ...)] ...)
|
|
fun-import | | = | | fun-id | | | | | | (orig-fun-id fun-id) |
|
Defines each fun-id as a function that, when called,
dynamically requires the export named orig-fun-id from the
module specified by module-path and calls it with the same
arguments. If orig-fun-id is not given, it defaults to
fun-id.
If the enclosing relative phase level is not 0, then
module-path is also placed in a submodule (with a use of
define-runtime-module-path-index at phase level 0 within the
submodule). Introduced submodules have the names
lazy-require-n-m, where
n is a phase-level number and m is a number.
When the use of a lazily-required function triggers module loading, it
also triggers a use of register-external-module to declare an
indirect compilation dependency (in case the function is used in the
process of compiling a module).
Examples: