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

From: Remco Bras (vrsoft at gmail.com)
Date: Sat Feb 20 08:21:27 EST 2010


I'm experimenting with a macro that requires access to a binding at
both run-time and expand-time.
Defining the binding two times, once with define and once with
define-for-syntax, will not do what I want since I need both bindings
to refer to the same mutable hash table.

I've tried the following, which puts the hash table in a module and requires it:

(module foo scheme
       (provide baz)
       (define baz (begin
                     (printf "Defining baz~n")

(require 'foo
        (for-syntax 'foo))

However, if the require is run, "Defining baz" is printed twice, and
the bindings for baz at phase level 0 and 1 refer to different hash
Is there a way to have these bindings refer to the same hash table?


Posted on the users mailing list.