I’m trying to run a reloading workflow just one step in complexity above the basic workflow as described in the manual.
I have a MWE which I believe fits the same pattern as given in the manual, but still does not seem to work. Can anyone tell me why?
julia --project=@. -i reloader.jl
> # now edit JuliaIncludeTest to say "Goodbye world"
WARNING: replacing module JuliaIncludeTest.
"Hello world" # wtf? it said it was replaced!
Project structure (or see https://github.com/akdor1154/jl-include-test)
greet() = print("Hello World!")
end # module
It sounds like you are looking for Revise.jl.
This will automatically reload code that changes in files and packages.
Thanks for the suggestion, but I started down this track (of working back to an MWE) because Revise wasn’t working for me either (for different reasons, some weird behaviour with Requires I think). So I started down the path of “reproduce as simply as possible”. Now I’m intrigued why this method doesn’t work, as it seems to contradict the manual saying that
include() should redefine included modules!
The reason why your
reload function doesn’t work the way you expect it to is that it is compiled before it runs. At compile-time
JuliaIncludeTest.greet() refers to a different function, because the
include has not happened yet.
If you’re having problems getting the right version of Revise.jl, it might the issue described in this thread.