-
Notifications
You must be signed in to change notification settings - Fork 38
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
macro capture #37
Comments
like this? @capture ex begin
f($x, y) => x # AST pattern
$(Expr(:meta, a)) => a # Expr pattern
end Does it really make sense for we already have the following? @match ex begin
:(f($x, y)) => x
Expr(:meta, a) => a
end It seems that |
Umm, it is just an eye candy of @capture <template> <expr>
@capture :(1 + $x + $y) 1 + a + b this will return a tuple: |
The problem is template = :(1 + $a + $b) # wrong! a, b would inserted here So you cannt do these:
If we quote an Expr twice |
@Roger-luo Would this be sufficient? https://thautwarm.github.io/MLStyle.jl/latest/tutorials/capture/ |
To make use of the fast speed of this package, a capture macro like MacroTools would be preferred. And instead of underscore, we could use current match's expr template style.
The text was updated successfully, but these errors were encountered: