7.10 Single-Unit Modules (original) (raw)

7.10 Single-Unit Modules🔗

When racket/unit is used as a language name with#lang, the module body is treated as a unit body. The body must match the following module-body grammar:

module-body = require-decl ...(import tagged-sig-expr ...)(export tagged-sig-expr ...)init-depends-declunit-body-expr-or-defn...
require-decl = (require require-spec ...)
| (begin require-decl ...)
| derived-require-form

After any number of require-decls, the content of the module is the same as a unit body.

The resulting unit is exported as base@, where base is derived from the enclosing module’s name (i.e., its symbolic name, or its path without the directory and file suffix). If the module name ends in -unit, thenbase corresponds to the module name before-unit. Otherwise, the module name serves asbase.