On Wednesday, June 8, 2016 at 5:25:27 PM UTC-4, Alex Knauth wrote: > It's that the implicit `#%app` within the definition of the `-encoding` macro > is within the scope of the definition, not the place where it's used.
Okay, I think I may get it. I knew starting out that there could be a problem with using macros defined in the scope of the normal #%app, but define and λ and a couple others worked so well... So in the case of define: (define-syntax (-define stx) (syntax-case stx () [(-define (name arg* ...) b0 b* ...) #'(define name (-λ (arg* ...) b0 b* ...))] ...) The reason the body ("b0 b* ...") expands correctly, despite being in the output of a macro defined in the scope of Racket's #%app, is that the body itself is lifted from the scope of -#%app and dropped into the output whole. Whereas in: #`(-define #,name+fields (-λ #,callback-id* (#,this-callback #,@name+fields))) Even though name+fields comes from the use site (and even though I tried replacing this-callback with another identifier from the use site to see what happened), the fact that they're being reconstituted in a new syntax pair in the scope of Racket's #%app is changing the behavior. Is that accurate? Anyway, I followed your advice of just putting the macro in the scope of -#%app and that did the trick; thank you. The reason I avoided doing that in the first place was because for some reason I assumed that the special symbols were cross-phase or something and would mess up the macro code. Oops. -- 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.