JuliaMath / JuliaMath/Calculus.jl
Evaluation into the closed module `Calculus` breaks incremental compilation...
- Dominant language
- Julia
- Stars
- 285
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
I have a complex code that broke when I switched from Julia 1.4 to Julia 1.5. The breakage seems to be intertwined with the Calculus package. I have tried but failed to produce an MWE (sorry about that). The context is that my complex code is doing some code generation in a macro and then calling `Calculus.simplify(ex)` on some generated expressions. The error I get when running my complex code is
```
Evaluation into the closed module `Calculus` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Calculus` with `eval` during precompilation - don't do this.
```
The stack trace leads me to [this line](https://github.com/JuliaMath/Calculus.jl/blob/e7def5fbf582ebc2c7d50f202d34acc6511a6324/src/symbolic.jl#L96). It seems like the `eval` is the source of the problem. Would there be any harm in `eval`ing in `Main` rather than Calculus itself? Switching that line to
```
return (@static (VERSION < v"0.7.0-DEV.5149") ? eval : Core.eval)(Main, ex)
```
solves my problem and all the tests still pass. I'd be happy to submit a pull request, but not sure if that solution would be accepted.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.