A workaround is to get location info from the outer syntax object ‘x’:

--8<---------------cut here---------------start------------->8---
(define-syntax zero!
  (lambda (x)
    (syntax-case x ()
      ((_ var)
       (begin
         (unless (identifier? #'var)
           (syntax-violation 'zero! "identifier expected" x)) ; <-- here
         #'(set! var 0))))))
--8<---------------cut here---------------end--------------->8---

I’m not sure why ‘var’ has no location info.

Ludo’.


Reply via email to