try
using Revise
catch e
@warn "Error initializing Revise"
end
try
using Infiltrator
catch e
@warn "Error initializing Infiltrator"
end
I put @infiltrate in a function and got a compiler error. I then exited and restarted Julia and tried using Infiltrator,<my package>, with the same error. Searching the Web for the right way to do it, I found mention of LOAD_PATH and @v#.# (which is the second element of Base.LOAD_PATH) but no explanation I could understand of how to add Infiltrator to either of them. So how do I do it?
You can, but you would need to add Infiltrator in the project dependencies. Possible for your projects, less suitable I would say for third party projects. But you can
try
using Revise
catch e
@warn "Error initializing Revise"
end
try
using Infiltrator
@eval Base begin
import Infiltrator: @infiltrate
export @infiltrate
end
catch e
@warn "Error initializing Infiltrator"
end
try
using Debugger
catch e
@warn "Error initializing Debugger"
end
I put @infiltrate in my code, loaded it with using, and got an error “@infiltrate not defined”. I typed @infiltrate in the REPL and got an infil> prompt.
I think you have stumbled on the case where you try to precompile code with the @infiltrate statements which does not work as startup.jl is not loaded by precompilation pipeline. The workflow that I use is:
Let the code to precompile without any @infiltrate statement in the code
Then add @infiltrate statements in the code and let Revise to recompile the necessary methods.
The first step could be resolved if we had ability to set a custom startup.jl file that is passed to precompilation, which could be ignored when running tests.
With loading the Infiltrator in the Base and exporting @infiltrate from there one has the same workflow regarding steps 4. - 6. The small advantage is that it is possible to use @infiltrate over Main.@infiltrate.