On Sunday, December 30, 2018 at 8:51:25 PM UTC-5, Matthew Butterick wrote: > > Without seeing "reader.rkt" or "expander.rkt" — I'd guess that: > > 1) `read-syntax` isn't stripping all bindings from its parse tree before > returning it. Though this isn't mandatory, it's a wise practice to avoid > mysterious binding problems like this one. (Use `strip-context` in > `syntax/strip-context`.) > > and > > 2) your list of literals in the `line` macro is stricter than you intend. > Macro literals match by datum AND binding, not merely by datum. So if you > say `(offset type test message)`, and you have `type` defined outside the > macro, then the literal will only match uses of that particular binding of > `type`. This is why `(provide type)` seems to fix the problem — you're > injecting the binding the macro pattern wants into the source environment. > Again, though Racket won't forbid you from managing bindings this way, it > can become a tangled web. >
I'm doing #1, so I think #2 is the explanation. 'type' is a function available in expander.rkt so the literal will only match that binding. The same is true for 'offset'. Both need to be provided. 'test' is not bound to anything because the macro uses 'compare' as the equivalent function, so 'compare' doesn't need to be provided. So I think it all makes sense. Thank you. -- Jonathan -- 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.