-
Notifications
You must be signed in to change notification settings - Fork 113
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
uparse breaks precompilation #649
Comments
Suggestion (from @ChrisRackauckas on slack, albeit without the Unitful context) to use Symbolics.jl (I guess this?: https://docs.sciml.ai/Symbolics/stable/manual/parsing/) or JuliaInterpreter (perhaps using https://juliadebug.github.io/JuliaInterpreter.jl/stable/dev_reference/#JuliaInterpreter.eval_code ?). |
A MWE would be interesting to see. |
I don't remember responding on Slack to anything related to unitful here, just on parsing a Julia expression 😅 . |
Sorry @ChrisRackauckas, I know I didn't mention Unitful on slack! The @timholy here's an MWE. Try to precompile the following package: module MyTestPkg
using PrecompileTools
using Unitful: uparse
@compile_workload begin
uparse("100s")
end
end You will get: ERROR: LoadError: Evaluation into the closed module `Unitful` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Unitful` with `eval` during precompilation - don't do this. Edit: @timholy Just realized you might have meant an MWE of the solution, not the problem... |
This precompiles successfully: module MyTestPkg
using PrecompileTools
using Symbolics
using Unitful
_my_uparse(s) = Symbolics.parse_expr_to_symbolic(Meta.parse(s), Unitful)
@compile_workload begin
_my_uparse("100m/s^2")
end
end Also, The |
JuliaInterpreter version: module MyTestPkg
using PrecompileTools
using JuliaInterpreter
using Unitful
_my_uparse(s) = JuliaInterpreter.finish_and_return!(Frame(Unitful, Meta.parse(s)))
@compile_workload begin
_my_uparse("100m/s^2")
end
end |
Hitting the same problem. Would highly appreciate some support 👍 |
It seems I cannot precompile code that makes use of
uparse
. In Julia 1.9 I get the errorwhile trying to
precompile
a package that has code that usesuparse
in its@compile_workload
block (usingPrecompilationTools
). The code just callsuparse
on a string (no module argument).The text was updated successfully, but these errors were encountered: