-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Writing a macro generates code utilizing NamedTuple whose value is calculated #32121
Comments
Please use https://discourse.julialang.org/ for general Julia questions. |
Forget about it. |
I think there is also a hygiene bug here though:
|
fix #32121, macro hygiene bug in named tuples
(cherry picked from commit d8798be)
(cherry picked from commit d8798be)
(cherry picked from commit d8798be)
(cherry picked from commit 07c2ecc)
(cherry picked from commit 07c2ecc)
(cherry picked from commit 07c2ecc)
(cherry picked from commit 07c2ecc)
@KristofferC I'm seeing this behaviour on Julia master, also related to named tuple hygiene:
I think the root cause is that named tuple syntax Angers The Lisp Gods: within a One proper fix would be to parse it differently: e.g. we should have
An alternative fix is to allow pair-valued expressions as elements of named tuples (currently a syntax error), e.g.
But given that you've worked on this recently, maybe we can come up with a solution that only touches the macro hygiene logic. What do you think? |
I'm not sure why I was pinged here? |
Oh, that's just cause I backported that commit to some release. #32464 is the original PR. |
Ah that makes sense, sorry for the noise! Added a comment there as well. |
(cherry picked from commit 07c2ecc)
I'm writing a macro tha packs it's parameter and @FILE into a NamedTuple and push it into a Vector, like this:
My think is to try avoiding other ways than esc to prevent
f
ands
from being renamed, or to make b work in escaped environment. However I tried$(esc(b))=a+1
and other escape forms, with none of them succeeded.Any suggestions?
The text was updated successfully, but these errors were encountered: