-
Notifications
You must be signed in to change notification settings - Fork 10
Add @might_produce
macro
#198
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
base: main
Are you sure you want to change the base?
Conversation
Libtask.jl documentation for PR #198 is available at: |
In v0.40 (or earlier?), TracedModel was moved from essential to src/mcmc/particle_mcmc.jl.
CI failuresThe AdvancedPS "integration test" is failing, because AdvancedPS CI itself is failing, because TuringLang/SSMProblems.jl#108 The benchmark test is failing because this is the first time it's ever been run with the new version of Turing that supports it. A lot of the code in there is not even updated for the current version of Libtask. It needs to be updated, but I'd rather not do it in this PR. The rest are Julia 1.12. |
8177399
to
73e7b68
Compare
function $(Libtask).might_produce(::Type{<:Tuple{typeof($(esc(f))),Vararg}}) | ||
return true |
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.
This line is a little bit of a sledgehammer: we're basically saying, 'any invocation of f
with any positional arguments might produce
'. This is not necessarily true because some methods of f
might produce
and some might not.
But since there isn't any real downside to marking all methods are produce
able, I don't think this is a huge issue. And if someone wants to be surgical, they can still use the non-macro version.
This PR introduces a macro to generate a superset of the
Libtask.might_produce
methods needed for a functionf
that might contain aproduce
call. For example, for a functioninstead of writing
you can just write
This works for functions with multiple methods and keyword arguments.
See #197 for the original motivation.