Stefan Israelsson Tampe <stefan.ita...@gmail.com> writes: > I want to get source location of a macro form and played a little with > syntax-source. This should then print out something. > > (define-syntax <+> > (lambda (x) > (syntax-case x () > ((o a b) > (pk (syntax-source x)) > #'(+ a b))))) > > (<+> 1 2) > > In trying to use the location of x resulted in the toplevel form > location and not the <+> form in a more complex example. and using > #'o or #'a or #'b in stead of x on syntax-source form will lead to pk > prints out #f.
Source properties are associated with source forms using an eq? hash table, and thus work only for parenthesized expressions, not for atoms. See section 6.52.2 of the manual for more on this. Best, Mark