-
-
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
Serialize dynamically generated anonymous functions closing over any module (not just Main) #22884
Comments
The rationale is that we expect packages to be loaded on all workers, so we can avoid serializing every function every time. Since package code is expected to be loaded everywhere, we can just send the name of the function instead of its full code. |
I should add that calling |
Certainly. This applies to functions defined in the module. But what about dynamic code? Simple example:
Is there a way we can identify dynamically generated code? I think this what Mamba.jl is doing.
Are you suggesting packages dynamically generating code should explicitly evaluate the expression under |
Here's a way to implement this. However I much more strongly encourage packages not to do this at all. It also breaks precompilation, for example. |
OK. Lets document this guideline then. Leaving the issue open till then.
How? Does eval'ing in a module trigger a complete recompilation? Will be good to document this too. |
Because the contents of the module varies from run to run, so the precompiled version of the module might not contain everything you need. |
The root cause of brian-j-smith/Mamba.jl#109 appears to be that we do not serialize anonymous functions closing over modules other than
Main
. The reduced test case is shown below.I think the check for this is at
julia/base/serialize.jl
Lines 507 to 510 in 8cd3c3f
What is the rationale for this limitation? Can it be removed?
The text was updated successfully, but these errors were encountered: