You can "pass" information from one macro to another by binding
information to an identifier defined to be a syntax parameter that
both macros have in scope. You would need to functionally update its
value for each rebinding. Its value would be retrievable with
syntax-local-value.
Like this, am I close? I tried to make a shortest possible example.
But it does not work as I expected: it prints "my-info =
#<set!-transformer>" rather than '(new-info).
#lang racket
(require (for-syntax syntax/parse syntax/transformer)
racket/stxparam)
(define-syntax-parameter my-info '())
(define-syntax (access stx)
(syntax-parse stx
((_)
(printf "my-info = ~v\n" (syntax-local-value #'my-info))
#''ok)))
(define-syntax (save stx)
(syntax-parse stx
[(_ body:expr)
#'(syntax-parameterize ((my-info
(cons 'new-info (syntax-local-value
#'my-info))))
body)]))
(save
(access))
Best regards,
Dmitry
--
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.