I have a macro (let's called it X) that generates unique symbols at
all its uses. I need all its uses to be distinguishable from each
other.

(define-syntax X
  (syntax-parser
    [(_ stx)
     (define label (gensym 'L))
     #`(log-error "at ~a (~a) ; ~a ~a"
                 '#,label
                 (quote-srcloc-string #,#'stx)
                 '#,(current-module-declare-name)
                 '#,(current-module-declare-source))]))

X is also used in many other macros:

(define-simple-macro (USE)
  (void (vector (X 'USE)))) ;; A

(X (or 'here #f))
(X 'there)
(USE) ;; B
(USE) ;; C

It works, but it would be better if (X 'USE) can log information about
its uses at B and C in addition to the source location A for debugging
purpose. If I don't want to change the implementation of USE, is there
a way for X to obtain the source information of B and C?

Currently, the only information I can get is the client module that
uses USE, obtained by checking (current-module-declare-name) at
expansion time in X.

Shu-Hung

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to