I'm making a #%module-begin macro, but I want to delegate it to an existing 

OK, let's start with a rename transformer:

(provide (rename-out [mb #%module-begin]))
(define-syntax mb (make-rename-transformer #'other-module-begin))
(define-syntax other-module-begin (λ (stx) #'foo))

That works, but I also need to pass some extra data to `other-module-begin` 
that controls how it's configured during this delegation. 

OK, let's add a syntax property. But wrapping the property around the 
transformer doesn't work, because a rename transformer is not `syntax?`:

(provide (rename-out [mb #%module-begin]))
(define-syntax mb (syntax-property (make-rename-transformer 
#'other-module-begin) 'foo "bar"))
(define-syntax other-module-begin (λ (stx) #'foo))

;; syntax-property: contract violation

I can wrap the property around the target identifier, but the syntax property 
doesn't stick:

(provide (rename-out [mb #%module-begin]))
(define-syntax mb (make-rename-transformer (syntax-property 
#'other-module-begin 'foo "bar")))
(define-syntax other-module-begin (λ (stx) #'foo))

(syntax-property #'mb 'foo) ; #f

Other possibilities with equivalent effect?

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to