> There is another way: syntax-local-introduce will remove the macro scope.
`syntax-local-introduce` is no longer useful for this purpose since the
switch to the scope sets model. Other scopes, such as module scopes, will
often distinguish the macro-introduced name. For example, using
`syntax-l
On 7/13/20, Roman Klochkov wrote:
> I tried
> ```
> (define-syntax my-file
> (make-require-transformer
>(lambda (stx)
> (syntax-case stx ()
>[(_ path)
> (printf "Importing: ~a~n" #'path)
> (expand-import #'(file path))]
> (require (my-file "test.rkt"))
> ```
I tried
```
(define-syntax my-file
(make-require-transformer
(lambda (stx)
(syntax-case stx ()
[(_ path)
(printf "Importing: ~a~n" #'path)
(expand-import #'(file path))]
(require (my-file "test.rkt"))
```
with the same result: no errors in require, but no import
The issue isn't actually with the `(_ (x y))` pattern---it's with the
`#'(require (x y))` template.
When `require` is passed a module path like `(file "test1.rkt")`, it
introduces any identifiers [just `ok` in this case] with the same lexical
context of the module path itself[1].
The issue is tha
I try to make a macro, that expands to the require form.
I put in test1.rkt
```
#lang racket/base
(provide ok)
(define ok 1)
```
I put in test.rkt
```
#lang racket
(define-syntax (req1 stx)
(syntax-case stx ()
[(_ x) #'(require x)]))
(define-syntax (req2 stx)
(syntax-case stx ()
[(_
5 matches
Mail list logo