-
Notifications
You must be signed in to change notification settings - Fork 7
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
Scope macro interactions by module #63
base: main
Are you sure you want to change the base?
Conversation
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Can we leave |
Does this check for hierarchies? Like if I define one behavior for (Maybe we should be relying on multiple dispatch to do this automatically for us...) |
@@ -17,50 +17,53 @@ end | |||
# Macros we dont want to propagate | |||
const MACRO_BEHAVIOR = (; | |||
table=Dict([ | |||
Symbol("@stable") => IncompatibleMacro, # <self> | |||
(Main => Symbol("@stable")) => IncompatibleMacro, # <self> |
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.
Just out of curiosity why have (::Module => ::Symbol) => ::MacroBehavior
as the table? Does it hash faster or something compared to a tuple? Also why not have ::Symbol => [(::Module => ::MacroBehavior), (::Module => ::MacroBehavior)]
?
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.
Also why not have ::Symbol => [(::Module => ::MacroBehavior), (::Module => ::MacroBehavior)]?
Purely because I didn't want to search the array and the module-macro pairs are unique anyways. I'm not otherwise attached to that implementation.
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.
Does it hash faster or something compared to a tuple
Oh, it's probably the same, I just like pair syntax and again am not attached to it.
Done!
It didn't, but does now!
How so? |
I speculated that mutating the table in the new test had a run-time order dependent effect, that seems to not be the case. I'm not sure what's causing the error. |
Implements the API described here. Hopefully you'll hear back about how DynamicQuantities.jl does it soon :)
Turing.@model
andMacroTools.@capture
are still getting special treatment and I don't think they should be built-in to the macro table, but there's not currently a way to make the default behavior extensible. This PR improves the situation overall though!Closes #43