[plt-scheme] defmacro problem in Swindle?

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed Jun 2 14:56:46 EDT 2004

Eli Barzilay wrote:
> On Jun  2, michael rice wrote:

> You're running into the phase separation problem: in MzScheme macros
> work in their own level, so they cannot use any run-time values.  Se
> the MzScheme documentation.

Michael, here is a simple example. Code used
both in code and for syntax is put in an extra
module and imported both in to the macro environment
and the normal environment (ignoring phases to simplify).

(module helpers mzscheme
   (provide (all-defined))

   (define (transform x)
     x))

(require (lib "defmacro.ss"))
(require-for-syntax helpers)
(require helpers)

(define-macro (transform-one body)
   (transform body))                 ; <- this transform is used in the macro environment

(transform-one #t)
(transform #t)                      ; <- this transfrom is used in normal environment


-- 
Jens Axel Søgaard




Posted on the users mailing list.