-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deep-matching on syntax objects #81
base: main
Are you sure you want to change the base?
Conversation
previously the only allowed shape was (macro-name arg1 arg2 arg2), now (macro-name (arg1 arg2) arg3), (macro-name arg1 (arg2 (arg3 arg4))) etc. are also supported.
(example (m1 foo bar baz)) -- '(m1 foo bar baz) | ||
(example (m2 foo)) -- 'foo | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following implementation is way more complicated than it needs to be. I wrote it first, and then I wrote syntax-pmatch
. I then tried to rewrite define-syntax-rule
in terms of syntax-pmatch
, but I encountered #80 . So I'll leave it as-is for now.
One feature I would like to implement next is the |
hmm, did I do something dumb performance-wise? A few tests are running much slower now:
|
Did you ever get some insight into the slowdowns? I suspect that it's a combination of the deep matching taking time to be expanded into large code, combined with said large code running slowly, but it would be interesting to know how much of it is our expander and how much is our interpreter. |
pmatch
is very convenient for deep-matching on datatypes, here is a version for syntax objects. That should make writing macros more pleasant!