Using different versions of the same module


#1

I have a module named KIT in a single file named KIT.jl.
using KIT is all what I need for using it.

Question:
If I have different versions of the file in the same directory
(e.g. KIT_2017-09-30.jl, KIT_2017-10-15.jl)
how can I use them without first renaming to KIT.jl ?


#2

The automatic loading in using designed/should not be used for that. Just include the file. You’ll obviously get name conflict if you’ve already imported one version and if you really want to have multiple versions loaded as the same time and confident that your own module can actually handle this you can wrap the include in another module that has a different name, i.e. module V1 include("v1.jl") end; module V2 include("v2.jl") end


#3

Thank you for the explanation.
So it seems I have to keep renaming backup files.

As the first line of each backup file is already module KIT,
and I prefer not touching the backup files,
this seems to be the only option now.

(Even after calling workspace() which I forgot to mention.)


#4

Also note that using a version control system, e.g. git, is usually a much better option…


#5

True.

Still many potential users work with a local workflow,
so I think the original question was relevant.


#6

Sure, but

is irrelevant. Version control, especially distributed version control systems like git, is a local workflow.


#7

Indeed, you can use git locally. Works really well.

I don’t know of your current workflow, but to work package development, I find Revise.jl to be really useful.