On Wednesday, July 20, 2016 at 1:56:02 AM UTC-5, Matthew Butterick wrote: > > > The problem is with 'POLY-FUNCS in the macro template. When you put the > quote mark on the front, then everything inside POLY-FUNCS gets treated as > a symbol. But in fact, you only want the target name to behave as a symbol, > and you want your new function-name identifier to behave as a variable > (that refers to your imported function). > > The solution is to match the target and function separately in your > `with-syntax` pattern, and then only put the quote mark on the first one > (once this problem is fixed, notice that the `eval` becomes unnecessary; > notice also the use of the `...` matching operator so we can handle the new > syntax bits in the template one at a time, rather than all at once): > > This is a big help for my understanding of macros, thanks. I felt that eval was a bit of a hack, but I had not understood that with-syntax could use `...` to produce repeating patterns that aren't tied to the syntax pattern passed in by `syntax-parse`. I guess I might have been able to infer this from Hendershott's explanation <http://www.greghendershott.com/fear-of-macros/all.html#%28part._with-syntax%29> that `with-syntax` can be considered as simply a rearranged `syntax-case`.
I'm still curious as to why one can't `eval` a symbol matching the name of a function in a Pollen file though, even when that function is defined in the same file. I will probably never absolutely need to use it that way, but it runs counter to my understanding of Pollen files as full-fledged Racket programs. -- You received this message because you are subscribed to the Google Groups "Pollen" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
