[racket] scribble/eval does not preserve syntax-original?
2011/8/16 Casey Klein <clklein at eecs.northwestern.edu>:
> Running this program:
>
> #lang racket/base
>
> (define binder #'x)
> (define bound #'x)
>
> (syntax-case (parameterize ([current-namespace (make-base-namespace)])
> (expand `(λ (,binder) ,bound)))
> ()
> [(_ (_ (binder) bound))
> `([binder ,(syntax-original? #'binder)]
> [bound ,(syntax-original? #'bound)])])
>
> produces:
>
> '((binder #t) (bound #t))
>
> Rendering this Scribble document:
>
> #lang scribble/doc
>
> @(require scribble/eval)
>
> @examples[#:eval (make-base-eval)
>
> (define binder #'x)
> (define bound #'x)
>
> (syntax-case (parameterize ([current-namespace
> (make-base-namespace)])
> (expand `(λ (,binder) ,bound)))
> ()
> [(_ (_ (binder) bound))
> `([binder ,(syntax-original? #'binder)]
> [bound ,(syntax-original? #'bound)])])]
>
> produces:
>
> Examples:
>
> > (define binder #'x)
> > (define bound #'x)
> > (syntax-case (parameterize ([current-namespace (make-base-namespace)])
> (expand `(λ (,binder) ,bound)))
> ()
> [(_ (_ (binder) bound))
> `([binder ,(syntax-original? #'binder)]
> [bound ,(syntax-original? #'bound)])])
>
> '((binder #f) (bound #f))
>
> Should these identifiers not satisfy syntax-original?
>
Oh, there's a much simpler pair of programs that shows the discrepancy:
#lang racket/base
(define stx #'x)
(syntax-original? stx)
#lang scribble/doc
@(require scribble/eval)
@examples[#:eval (make-base-eval)
(define stx #'x)
(syntax-original? stx)]
I need syntax-original? to hold to add examples to the Check Syntax API docs:
http://pre.racket-lang.org/docs/html/tools/Check_Syntax.html?q=annotations-mixin#%28def._%28%28lib._drracket/check-syntax..rkt%29._annotations-mixin%29%29
Should I just use `racketmod' and make readers copy, paste, and run
the code to see the results?