Import for syntax transformer

hello,
i'm refactoring one of my project with modules in scheme , it is running on different implementations of scheme (guile,racket, kawa,...) , i try to use R6RS or R7RS for compatibility.
I have many modules.
One of them has a syntax transformer that reuse some variables of other modules but it fails to find them , because the syntax transformer eval variables in a different context than the one where my modules are imported .I suppose that
when i see the error message:

evaluating syntax transformer '$nfx$' threw unbound location: infix-operators-lst-for-parser-syntax

the code of the macro $nfx$ is this:

 (define-library (nfx) ; R7RS

          (import 
              (n-arity)
              (infix-with-precedence-to-prefix)
              (operators))

              (export $nfx$) 

(define-syntax $nfx$

  (lambda (stx)
   
    (syntax-case stx ()
         (($nfx$ e1 op1 e2 op2 e3 op ...)  
               (with-syntax ((parsed-args (n-arity (!0-generic #'(e1 op1 e2 op2 e3 op ...) infix-operators-lst-for-parser-syntax (lambda (op a b) (list op a b))))))  

   #'parsed-args))))))) ; end module 

is there a way to make it run ? syntax transformer of $nfx$ must know infix-operators-lst-for-parser-syntax which is in operators

Update: i'm thinking of a bug in Kawa scheme , i'm testing that.... (code goes forward when defining the variable in a let() in the syntax transformer - but i can not put all the code in it !) probably code would work in Racket or Guile but i have not yet port the code in a modular way in Racket. I'm checking and doing.......

Kawa bug confirmed. Should works without modification in Racket.Question was not relevant of Racket or Scheme.

1 Like