2.26 Importing Modules Lazily: lazy-require
The bindings documented in this section are provided by the racket/lazy-require library, not racket/base or racket.
syntax
(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, register-external-module declares a potential compilation dependency (in case the function is used in the process of compiling a module).
Examples: | |||||||||||||||||||||||||||
|