> 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-local-introduce` won't produce the desired behavior when `req2` is 
defined in one module and used in another.

On Monday, July 13, 2020 at 6:32:58 PM UTC-6, Ben Greenman wrote:
>
> On 7/13/20, Roman Klochkov <kalime...@gmail.com <javascript:>> 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")) 
> > ``` 
> > with the same result: no errors in require, but no imports. 
> > 
> > So, it seems, that the only solution is datum->syntax. It works fine. 
>
> There is another way: syntax-local-introduce will remove the macro scope. 
>
> ``` 
> (define-syntax (req2 stx) 
>   (syntax-case stx () 
>     [(_ (x y)) (syntax-local-introduce #'(require (x y)))])) 
> ``` 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/95494fe6-9a3f-42ac-a5c3-bf8c91c91c69o%40googlegroups.com.

Reply via email to