14 Racket Module Operations
A contract matching accepted value types when reading a Racket module.
A contract matching accepted value types for an in-memory
representation of a Racket program. In the context of this library,
this can either be a Racket module form, or some list of instructions
A contract matching accepted value types for an in-memory representation of Racket module code.
if (get-racket-module-body modlang v)
would not fail. This does not verify the functionality of the module.
Returns the top level forms of code, or #f if the
module language does not match expected-lang. If
expected-lang is #f, then the module language is not
The return type value mirrors that of the input value type. That is,
(list? code) implies (list? (get-racket-module-body #f code)).
Equivalent to (apply list 'module id lang top-level)
is a list, then returns code
Otherwise, returns (syntax->datum code)
Returns a logged procedure
that reads a Racket module’s code
and returns the resulting syntax object with minimal
expansion. Reading is limited to the reader extension provided by the
collection path in expected-reader-lang
, and the module
language must match expected-module-lang
If variant is an input port, read-racket-module
will attempt to read code directly from variant.
If variant is a path, string, or byte string, then the
behavior is equivalent to applying read-racket-module to an
input port for the file, string content, or byte content respectively.
If variant is a list, then the behavior is equivalent to
applying read-racket-module to an input port for (~s variant).
14.1 Stripping and Dressing
To strip a Racket module in code/c form is to
convert it to a bare module. To dress the module is
to do the reverse. Stripping and dressing are not inverse operations,
because stripping does not preserve lexical and location information.
In the context of Xiden, programs are restricted to a small, fixed
grammar and are subject to meaningful module-level overrides. This
makes source location information meaningless in some cases, but
lexical information remains constant. Xiden uses bare modules
when only the content matters for code transformations.
Each instance holds parts of a Racket module code without lexical
information, source location information, or an implicit form for a
module body such as #%plain-module-begin.
14.2 Fetching Racket Modules in Package Definition
If compile-with is not #f, it is used as the first
argument to run for selecting a raco executable. Once
the module is available, it is immediately compiled using the