I have some code with this general structure
push!(LOAD_PATH, Base.source_dir()) Base.compilecache(Base.PkgId("Mod1")) using Mod1 using Mod2 Mod2.bar(5)
where Mod2.jl also has
When I do this, I get a large number of “WARNING: Method definition __ overwritten…” for methods that are indeed in Mod1.
First, I get these warnings from the compilecache call (which is not there to be useful so much as to figure out what’s going on). Then I get them again for the “using Mod1” in Mod2.
I don’t get warnings for all the methods in Mod1 though, probably only about 1-2% of them, actually. I can’t see anything that is special about those methods.
I’d give a complete replicable example, but I haven’t been able to create one. My Mod1 is huge, with more than 10,000 lines of code. For simple Mod1 equivalents, I don’t get any warnings (which is consistent with how I only get warnings for a small portion of the functions).
If I put precompile(false) in Mod1, the warnings go away. (Similarly, they might go away if I used include instead of using to bring in the modules.) But I’d like to (a) be able to precompile and (b) understand this so I have a good workflow in Julia in the future.