[plt-scheme] define-for-syntax, or lack thereof
> How come there is no define-for-syntax form?
Limited imagination on the part of the implementor.
> When I have a syntactic
> operation that is commonly used in the macros of one module, but nowhere
> else, it is kind of tedious that I have to make a separate module where to
> put the definitions for those operations. Would inline definitions for the
> transformer environment somehow break the phase separation?
No, that would work fine. I just wasn't able to see this while working
out the first specification and implementation.
> Also, why is there no begin-for-syntax? Even the paper on the module system
> system uses that in code examples, and there was no mention of anything
> being wrong with it. Wouldn't a dummy syntax definition do the same thing,
> at (module) top level anyway?
Yes.
In the next iteration of modules, I plan to add `begin-syntax'. It's
like a top-level `begin' --- in particular, definitions are allowed ---
except that the body expressions are shifted into the next phase.
Then,
(require-for-syntax ....)
will expand to
(begin-syntax (require ....))
and
(define-for-syntax ....)
could be written
(begin-syntax (define ....))
In addition, `begin-syntax' could be nested in `begin-syntax' to get
forms such as `require-for-syntax-for-syntax'.
Hopefully I'll be able to implement this sometime in the fall. (I had
hoped for this summer, but there was no time.)
Matthew