-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Update pattern-matching.md #202
Conversation
Explain why QuoteNode never matches
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.
Thank you for the documentation PR! Could you please post an example of the code? I don't quite get what you're referring to.
Co-authored-by: Cédric St-Jean <[email protected]>
@match :(:a) begin
s_QuoteNode => 1
s_quote => 2
end You might expect the first pattern to match but actually its the second one that does so the result of that expression is |
I see! Perhaps that example would be good to add to the PR. Do you think it'd be reasonable to fix it? We can merge this PR in the meantime if you don't have time to consider it, but special-casing |
If the Julia parser only produces QuoteNodes for quoted symbols then it would make sense to change the way MacroTools handles QuoteNodes. And as far as I know that's the case but I’m not sure on that. In a sense then though MacroTools currently does special case QuoteNode so making it work the way I expected would mean removing that special case. Which is just 1 line |
And that line comes from 1e01db9, 9 years ago, with not much to go on. The problem with MacroTools is that A) it is lacking test cases B) breaking it can break a good chunk of the Julia ecosystem... Ah, I'd lean towards merging this PR at the moment unless we are really confident of the implications of removing that line. It's more or less a breaking change. Can you please add the example you posted above? |
Yeah I think the best we can do is document the odity for now. I reworded it to include the example. How does it read now? |
Perfect, thanks. |
Explain why QuoteNode never matches