[R6RS] modules
Matthew Flatt
mflatt
Mon Aug 23 08:40:34 EDT 2004
At Mon, 23 Aug 2004 00:41:49 -0500 (EST), "R. Kent Dybvig" wrote:
> > Also, given
>
> > (module N (def-f-mac)
> > (require M)
> > (define-syntax def-f-mac
> > (lambda (stx)
> > #'(define-syntax f (lambda (stx) x)))))
>
> > every use of the macro `def-f-mac' would lead to a syntax error, right?
>
> Right.
Good --- so far I understand. But how about
(module M (x get-x)
(require M)
(define x 5)
(define (get-x) #'x))
(module N (def-f-fun def-f-mac)
(require only-for-syntax M)
(define-syntax def-f-mac
(lambda (stx)
(with-syntax ((x2 (get-x)))
#'(define-syntax f (lambda (stx) x2)))))
(define-syntax def-f-fun
(lambda (stx)
(with-syntax ((x2 (get-x)))
#'(define f (lambda (stx) x2))))))
I expect that either `def-f-mac' or `def-f-fun' always works, and the
other never works. But which one (if either)?
[In the analogous MzScheme code, `def-f-mac' would work. ]
Thanks,
Matthew
More information about the R6RS
mailing list