-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Add Base.is_serializing_code() for guarding precompilation code
#45650
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
Add Base.is_serializing_code() for guarding precompilation code
#45650
Conversation
2893728 to
07d0f8e
Compare
timholy
left a comment
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.
Thanks for doing this!
|
Would it be worth including an example of why you might want this kind of guard? For example, suppose you start julia with |
|
How about |
|
Yeah I share similar reservations about What about "Saving" made me think of saving human-readable code, like |
|
|
|
From triage: AttendingLasting thoughts:
Discussed names
Bad names
|
|
I will point out that this is really a question about what command-line options were passed, i.e. "is the julia runtime being run in a mode where what you do might be saved for later use?" so it is in fact system-global. |
|
Triage decided that with the creation of JuliaDebug/SnoopCompile.jl#282 which wraps this ccall, the need for this to be formalized in the API isn't necessary |
ccall(:jl_generating_output, Cint, ()) == 1is used in the ecosystem widely to guard precompilation code. It seems like it should be formally in the API.A slack discussion with @timholy arrived at this name.
is_precompilingseemed like a good name at first, but is confused byprecompilecalls, which precompile code at a time wherejl_generating_output != 1. Andis_generating_outputseemed a bit vague.