So I tried to get hold of the macro binding. So with the following patch wich should be enogh
for me to make progress porting rackets syntax parse to guile.
Would be very glad if we could find a interface to expose this information that is sane
and rigid manner. So we should discuss this feature.
Anyway about the patch.
I added a fluid that is setted with a closure that captures enough syntax information
so that we can lookup the macro value local or global. It basically uses the same method
as psyntax macroexpander.
Now we can write,
(define-syntax info
(lambda (x)
(syntax-case x ()
((_ x)
(pk (syntax-binding-info (syntax->datum #'x)))
#'#f))))
and calling this in an example lead to
(let-syntax ((a (lambda (x) #'#f)))
(info a))
;;; ((macro . #<procedure 1a68480 at ice-9/eval.scm:396:13 (a)>))
or
(let ((a 1)) (info a))
((lexical . #{a 310}#))
So with this I can attach meta information to macros local or not by using a weak hash.
Anyway a hack but it shows what is needed.
Happy Hacking :-)