Re: [racket-users] require and syntax-case

2020-07-14 Thread Michael Ballantyne
> 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

Re: [racket-users] require and syntax-case

2020-07-13 Thread Ben Greenman
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")) > ```

Re: [racket-users] require and syntax-case

2020-07-13 Thread Roman Klochkov
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

Re: [racket-users] require and syntax-case

2020-07-12 Thread Michael MacLeod
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

[racket-users] require and syntax-case

2020-07-12 Thread Roman Klochkov
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 () [(_