[racket] getting one macro to tell another macro to define something

From: Alexander D. Knauth (alexander at knauth.org)
Date: Fri Aug 1 17:12:00 EDT 2014

Is there any way to do something like this and have it work?:
#lang racket
(require racket/stxparam
         (for-syntax syntax/parse
;; current-defs : (syntax-parameter-of (or/c set-mutable? #f))
(define-syntax-parameter current-defs #f)
(define-syntax sender
  (lambda (stx)
    (syntax-parse stx
      [(sender def)
       (define defs (syntax-parameter-value #'current-defs))
       (set-add! defs #'def)
(define-syntax reciever
  (lambda (stx)
    (syntax-parse stx
       (define defs (syntax-parameter-value #'current-defs))
       (with-syntax ([(def ...) (set->list defs)])
         #'(begin def ...))])))

(syntax-parameterize ([current-defs (mutable-set)])
  (sender (define x 1))

Right now, x is undefined.  

I’m guessing that that’s because it has the wrong syntax marks, but is there any way around that?  
(Other that doing (datum->syntax stx (syntax->datum …)) on everything?)

Posted on the users mailing list.