[racket] scribble/eval does not preserve syntax-original?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Aug 17 08:23:34 EDT 2011

This is now fixed.

At Wed, 17 Aug 2011 05:59:06 -0500, Casey Klein wrote:
> 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?
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.