[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] importing a syntactic binding for level -1
From: |
Marco Maggi |
Subject: |
Re: [Chicken-users] importing a syntactic binding for level -1 |
Date: |
Sat, 13 Jul 2019 14:12:48 +0200 |
Peter Bex wrote:
> This won't work. "rename" is operating in the syntactic environment
> of the transformer. You can pass it as a procedure to some other module,
> but that won't change its internal state.
So, is RENAME closed upon the environment in which ER-MACRO-TRANSFORMER
is called? So I can do something like:
(module (for-expand)
(the-transformer)
(import (scheme)
(chicken syntax))
(define (the-transformer input-form.stx rename compare)
(define %fx+ (rename 'fx+))
---)
#| end of module |#)
(module (for-runtime)
()
(import (scheme)
(chicken syntax)
(chicken fixnum))
(import-for-syntax (scheme)
(for-expand))
(define-syntax the-macro
(er-macro-transformer the-transformer))
#| end of module |#)
and RENAME will cleanly pick FX+ from the environment in which
ER-MACRO-TRANSFORMER has been called?
I'm not trying to inject syntactic bindings in the original
environment, I just want to put as much as possible of a macro body into
a separate library to be imported "for syntax".
--
Marco Maggi