guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax-source


From: Mark H Weaver
Subject: Re: syntax-source
Date: Sat, 16 Apr 2011 22:21:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Stefan Israelsson Tampe <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]