JuliaNLSolvers / Optim.jl

Optimization functions for Julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`eval` in OptimMOIExt fails to precompile

ven-k opened this issue · comments

fatal: error thrown and no exception handler available.
InitError(mod=:OptimMOIExt, error=ErrorException("Evaluation into the closed module `Optim` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Optim` with `eval` during precompilation - don't do this."))

MWE:
With a optim-test/OptimTest.jl file that has:

module OptimTest

using MathOptInterface
using Optim

end
pushfirst!(LOAD_PATH, "optim-test")
using OptimTest

For v1.9+ the solution is to use setglobal! I suppose, but what about v1.8- ?

I think the easiest is just to keep MOI as a regular dependency on Julia < 1.9: #1088