[racket] getting the term in syntax-id-rules

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Mon Sep 5 11:50:24 EDT 2011

In a syntax-case, I can obtain the term being processed: eg,

(define-syntax (foo stx)
  (syntax-case stx ()
   [... (with-syntax ([term stx]) ... #'term)]))

In syntax-id-rules, the RHS is like a syntax-*rules*, so I don't know
of a way of obtaining access to the source.  This would be
particularly useful since my id macros are expanding into regular term
macros, but I'd like the user to see errors in terms of the id text
(which I'm storing in a structure, hence the #'term above).

Sorry if I'm missing something obvious; hopefully an archival answer
to this will help anyway.


Posted on the users mailing list.