The documentation says that "m [the first subform of require/typed] is a module spec", but the docs don't define "module spec". In the cases I've tried, it seems to mean a require-spec in the sense of require.
If "module spec" is supposed to mean require-spec, one solution might be to use expand-import, or local-expand to #%require, then rewrite the repeated (require (only-in m [old new])) forms to something like (#%require (rename m* new old)).
Alternatively, if "module spec" is supposed to mean something else—e.g. a module path—that requirement should be enforced and documented.
In any case, in the documentation, I think the first sentence of the "Require" documentation section, "Here, m is a module spec, pred is an identifier naming a predicate, and maybe-renamed is an optionally-renamed identifier.", should be moved under the blue box for require/typed, rather than above it: I missed it when jumping to the documentation for require/typed. I also think a cross-reference link to whatever "module spec" is supposed to mean would be helpful.
I ran into this while looking into a question on Discourse, so there is some concrete interest in the functionality of a general require-spec.
What version of Racket are you using?
8.12 [cs]
What program did you run?
What should have happened?
It should have printed:
But instead, it printed:
Discussion
The documentation says that "
m
[the first subform ofrequire/typed
] is a module spec", but the docs don't define "module spec". In the cases I've tried, it seems to mean arequire-spec
in the sense ofrequire
.If "module spec" is supposed to mean
require-spec
, one solution might be to useexpand-import
, orlocal-expand
to#%require
, then rewrite the repeated(require (only-in m [old new]))
forms to something like(#%require (rename m* new old))
.Alternatively, if "module spec" is supposed to mean something else—e.g. a module path—that requirement should be enforced and documented.
In any case, in the documentation, I think the first sentence of the "Require" documentation section, "Here,
m
is a module spec,pred
is an identifier naming a predicate, andmaybe-renamed
is an optionally-renamed identifier.", should be moved under the blue box forrequire/typed
, rather than above it: I missed it when jumping to the documentation forrequire/typed
. I also think a cross-reference link to whatever "module spec" is supposed to mean would be helpful.I ran into this while looking into a question on Discourse, so there is some concrete interest in the functionality of a general
require-spec
.