[plt-scheme] adding syntax transfomer to a namespace

Matthew Flatt mflatt at cs.utah.edu
Fri Dec 14 10:41:47 EST 2007


At Thu, 13 Dec 2007 16:25:33 -0800, "Dan Liebgold" wrote:
> Is there any way to emulate the behavior of define-syntax[es] by explicitly
> defining a transformer in a namespace?   I'd like to store a transformer in
> a list, then create a namespace later and add the transformer to it such
> that the various expand functions will honor it.

I don't think there's any alternative to `eval' for that task:

  (define (add-binding name transformer)
    (eval #`(define-syntax #,name #,transformer)))

All the usual caveats for using `eval' apply in this case. (Hopefully,
those caveats will get collected in the new documentation in the near
future).

Matthew




More information about the plt-scheme mailing list