4 ms·
Great solution! Thanks for sharing. Your last example is especially interesting, as it shows the problem with the reader extensions I forgot to mention in the
by klibertp 10y ago
Great solution! Thanks for sharing.
Your last example is especially interesting, as it shows the problem with the reader extensions I forgot to mention in the post: the introduced identifiers have local scope. In other words, both redefining `string-append` and not having it in local scope when calling it are problems.
In your solution the `#'format` expression binds the `format` function to whatever is called `format` in the current module (but in the next phase, which is why you require `#%datum` normally and not `for-syntax`).
I regret not putting the hygiene considerations into the post, I planned it but, honestly, forgot about it :( I'll add it to the post, along with your solution (is that alright?)
- arithmetization 10y agoI think just tweaking your parse method to use #'string-append and #'~a would be enough to preserve hygiene for your introduced identifiers. datum->syntax will happily work with mixed combinations of syntax-objects and data. And yes, feel free to do anything with that example and share further. Not enough people have had exposure to Racket's implicit expansion macros. (Is that even what they're called?)
- klibertp 10y ago> I think just tweaking your parse method to use #'string-append and #'~a Yes, but then I'd need to explain what the syntax objects really are instead of calling them "some meta-data on top of a list" and moving on :)