guile-user
[Top][All Lists]
Advanced

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

Re: Macro expansion: unknown location


From: Mark H Weaver
Subject: Re: Macro expansion: unknown location
Date: Sat, 14 Jun 2014 14:21:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> A workaround is to get location info from the outer syntax object ‘x’:
>
> (define-syntax zero!
>   (lambda (x)
>     (syntax-case x ()
>       ((_ var)
>        (begin
>        (unless (identifier? #'var)
>          (syntax-violation 'zero! "identifier expected" x)) ; <-- here
>        #'(set! var 0))))))
>
> I’m not sure why ‘var’ has no location info.

Currently, Guile stores location info using a weak-key hash table, keyed
on the datums read from the file.  This means that location info cannot
be stored for bare symbols or other immediate values (booleans,
characters, small exact integers).

I intend to fix this at some point, but it entails using a reader with a
different API than the standard reader.  The new reader would have to
return symbols and immediates wrapped in some other data type.

      Mark



reply via email to

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