[plt-scheme] Eq bindings at different phase levels?

From: Remco Bras (vrsoft at gmail.com)
Date: Sat Feb 20 09:11:25 EST 2010

On Sat, Feb 20, 2010 at 2:50 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> Can you say more about why you want to share a mutable table between
> expand time and run time?
The idea is to write a macro "with", whose calls are of the form (with
(clause ...) body ...). (with () body ...) is equivalent to (begin
body ...), but with one or more clauses, the result is under control
of a user-specified transformer.
Each clause starts with an identifying symbol, which would be the key
for the mutable table, the transformer being the value.

In more detail, it could be defined as follows:
(define-syntax (with exp)
  (syntax-case exp ()
    [(with () body ...)
     #'(begin body ...)]
    [(with ((name args ...) clause ...) body ...)
     ((with-transformer (syntax->datum #'name)) #'((name args ...)
(with (clause ...) body ...)))])))

In the above, with-transformer is intended to be a procedure querying
the shared table.
Procedures to modify the table and (re-)define transformers would be
provided in phase level 0.


Posted on the users mailing list.