[racket-dev] some surprising behavior with syntax-parameterize and lexical info

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Thu Apr 5 22:31:58 EDT 2012

> If that doesn't seem clear, can you explain more your line of reasoning
> that they should be the same?


I guess I'm having a hard time with this: I want to get the value of
a-placeholder into the place marked ??? in the following:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-syntax (def stx)
 (syntax-case stx ()
   [(_ (name args ...) body ...)
    (let ([a-placeholder (datum->syntax stx 'placeholder)])
      (quasisyntax/loc stx
        (splicing-syntax-parameterize ([current-def ???])
          (define (name args ...)
            body ...))))]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

a-placeholder is a compile-time expression, so I expected to be able
to somehow bind current-def to it, but I'm hitting "indentifer used
out of context" errors when I do so.


I suspect that I should be using quote-syntax at this specific point,
but I am not completely sure.

Posted on the dev mailing list.