8.16.0.4
6 Dynamic Require of Rhombus Exports
(require rhombus/dynamic-require) | package: rhombus-lib |
The rhombus/dynamic-require module provides a function similar to Racket’s dynamic-require, but for accessing Rhombus module exports, potentially through dotted names.
procedure
(rhombus-dynamic-require mod name) → any/c
mod : module-path? name : (or/c symbol? (listof symbol?))
Although dynamic-require works for Rhombus exports that
correspond to plain variables, dynamic-require cannot get the
value of a Rhombus binding like the one constructor function default by
class, and it cannot access dotted paths that go through a
Rhombus namespace.
The rhombus-dynamic-require handles Rhombus bindings more generally. When name is a list, it access an export that corresponds to using the dot operator between the elements of the list.
Static access is normally better than dynamic access, so consider using rhombus-expression instead of rhombus-dynamic-require.