[racket-dev] splicing-syntax-parameterize and syntax-parameter-value

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Thu Nov 29 16:01:09 EST 2012

(require racket/stxparam racket/splicing)
(define-syntax-parameter f #f)
(splicing-syntax-parameterize ([f #t])
  (begin-for-syntax (printf "~a~%" (syntax-parameter-value #'f)))

This prints #f.

If I instead add a macro indirection

(define-syntax (blah stx) (syntax-case stx () [(_ f) (printf "~a~%" (syntax-parameter-value #'f)) #'(void)]))


(splicing-syntax-parameterize ([f #t])
  (blah f)

prints #t

This is messing up some of my syntax parameters that build their definitions from the existing value in the parameter. Why does the first program have this behavior? This feels bug-like to me.

Posted on the dev mailing list.