l...@gnu.org (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