[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] importing a syntactic binding for level -1
From: |
Marco Maggi |
Subject: |
[Chicken-users] importing a syntactic binding for level -1 |
Date: |
Sat, 13 Jul 2019 08:26:56 +0200 |
Ciao,
it is my understanding that, if I write a macro as follows:
(import (scheme)
(chicken fixnum))
(import-for-syntax (scheme)
(only (chicken syntax)
er-macro-transformer))
(define-syntax spiffy
(er-macro-transformer
(lambda (input-form.stx rename compare)
(define %fx+ (rename 'fx+))
---)))
the function RENAME will pick "fx+" from the runtime environment (which
is level 0).
I would like to write such macro as:
(import (scheme)
(chicken fixnum))
(import-for-syntax (scheme)
(only (chicken syntax)
er-macro-transformer)
(only (my-lib)
doit))
(define-syntax spiffy
(er-macro-transformer
(lambda (input-form.stx rename compare)
(define %fx+ (doit rename))
---)))
and in the library "(my-lib)" I have:
(define (doit rename)
(rename 'fx+))
but for this to work cleanly: in "(my-lib)" I should import "fx+" at
level -1? Is it right?
This is possible with R6RS implementations. How about CHICKEN?
TIA
--
Marco Maggi
- [Chicken-users] importing a syntactic binding for level -1,
Marco Maggi <=