7.11 Single-Signature Modules (original) (raw)
7.11 Single-Signature Modules🔗ℹ
The racket/signaturelanguage treats a module body as a unit signature.
The body must match the following module-body grammar:
| module-body | | = | | (require require-spec ...) ... sig-spec ... | | ----------- | | -- | | ------------------------------------------------------------------------------------------------------------------------------------ |
See Creating Units for the grammar of sig-spec. Unlike the body of a racket/unit module, arequire in a racket/signature module must be a literal use of require.
The resulting signature is exported asbase^, 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-sig, then base corresponds to the module name before -sig. Otherwise, the module name serves asbase.
A struct form as a sig-spec is consistent with the definitions introduced by define-struct, as opposed to definitions introduced by struct. (That behavior was originally a bug, but it is preserved for compatibility.)