[plt-scheme] Macro-expansion-time structs

From: Henk Boom (lunarc.lists at gmail.com)
Date: Sat Oct 11 23:22:31 EDT 2008

2008/10/11 Carl Eastlund <cce at ccs.neu.edu>:
> You've defined the struct in the runtime environment.  You need to
> define it in the transformer environment if you want transformers to
> use it.  You might accomplish that like this (though this makes a
> local definition other transformers won't be able to use):
>
> #lang scheme/base
>
> (require (for-syntax scheme/base))
>
> (provide test)
>
> (define-syntax test
>  (let ()
>   (define-struct my-box (val))
>   (lambda (stx)
>     #`#,(my-box-val (make-my-box 2)))))

I see. It's a pity that (begin-for-syntax (define-struct . . .)) doesn't work.

Thanks for the info!
    Henk


Posted on the users mailing list.