[racket] How to use structure inside define-syntax ?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 21 09:26:38 EDT 2011

At Thu, 21 Apr 2011 18:34:45 +0530, Veer wrote:
> I still get error when i do
> 
> (begin-for-syntax
>   (struct proc-struct  (name args loe)))
> 
> error:  " define-syntaxes: syntax definitions not allowed within
> begin-for-syntax ..."

This is a limitation of the module system (which I hope to remove one
day soon). Work around it by adding `#:omit-define-syntaxes':

 (begin-for-syntax
   (struct proc-struct (name args loe)
           #:omit-define-syntaxes))


You could also use `struct' in a separate module that is imported with
`(require (for-syntax ...))', but maybe you want to keep everything in
one module.



Posted on the users mailing list.