Hi, I'm having trouble writing a syntax transformer that uses a 
syntax-generating procedure defined elsewhere.

When the procedure is defined locally, everything is fine.

When the procedure is defined outside the transformer, I have to do a dance 
to make the procedure visible at the right phase, which seems to work.  
However, upon use I get:

> racket unbound-identifier.rkt
unbound-identifier.rkt:9:7: lambda: unbound identifier;
 also, no #%app syntax transformer is bound
  context...:
   #(1973 module unbound-identifier 0) #(2181 module) #(2811 macro) #(2822 
local)
   #(2823 intdef) #(2824 module (unbound-identifier utilities) -1)
  other binding...:
   #<module-path-index:(racket)>
   #(1972 module) #(1973 module unbound-identifier 0)
  at: lambda
  in: (lambda (i) (displayln (quasiquote (input: (unquote input)))))
  context...:
   standard-module-name-resolver
 

I wrote this self-contained example using a submodule, but the error also 
occurs when requiring the module from another file.  What am I doing 
wrong?  I imagine it's something silly.


#lang racket
(provide this-works this-does-not-work)

(module utilities racket/base
  (provide compile-test)

  (define (compile-test)
    #`(lambda (i) (displayln `(input: ,input)))))

(require (for-syntax 'utilities))


(define-syntax (this-works stx)
  (syntax-case stx ()
    ((_ input)
     (let ()
       (define (compile-test)
         #`(lambda (i) (displayln `(input: ,input))))

       #`(#,(compile-test) input)))))

(define-syntax (this-does-not-work stx)
  (syntax-case stx ()
    ((_ input to-do ...)
     (let ()

       #`(#,(compile-test) input)))))

(this-works 3)
(this-does-not-work 3)

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to