syntax-original? is querying a private property and that property isn't set on the syntax object argument given to the transformer. (I would have said because of the extra mark that's put on the argument, but that's not happening now, but we get the same behavior anyway.)
If you call syntax-local-introduce, you'll see the expected printouts: #lang racket (define-syntax (print-original stx) (syntax-case stx () [(_ datum) (begin (displayln (syntax-original? (syntax-local-introduce #'datum))) #'#'datum)])) (syntax-original? (print-original 'foo)) Robby On Tue, Oct 27, 2015 at 1:56 AM, Alexis King <lexi.lam...@gmail.com> wrote: > I wrote a simple program that determines whether a piece of syntax is > original in two different ways: > > (define-syntax (print-original stx) > (syntax-case stx () > [(_ datum) > (begin > (displayln (syntax-original? #'datum)) > #'#'datum)])) > > (syntax-original? (print-original 'foo)) > > Running it prints #f, then #t. This seems to imply that #'datum is not > considered syntax-original? within the syntax transformer, but in the > expansion, it is. Stepping though the expression within the macro stepper, > the identifier always seems to be considered original, so I would expect both > cases to be #t. > > Why is the result of syntax-original? different within the two contexts? If > this is the intended behavior, could it maybe be explained in the > documentation? > > Thanks, > Alexis > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.