I have a bunch of random scripts that I’ve accumulated over the course of a few months. These are small things that I wrote to illustrate a half-baked idea while making meetings with my advisor.
I want to make sure these scripts work, in case I ever need to return to these ideas, but I don’t want to put in the effort to turn all of these ideas into a cohesive package. The scripts are all roughly
struct Economy
r
s
end
function solve_for_equilibrium(e::Economy)
...
end
function main()
r = .05; s = .2;
e = Economy(r, s)
solve_for_equilibrium(r, s)
end
Given that they all share a Project.toml
, I want an easy way to make sure I don’t break anything when I ] up
. I definitely don’t want to put in the effort to make each tiny script have their own package structure.
So I created a test/runtests.jl
and it looks like this
module jan_31
include("../src/jan_31.jl")
main()
end
module feb_18
include("../src/feb_18.jl")
# no functions, al in global scope
end
module feb_25
include("../src/feb_25.jl")
main()
end
module march_10
include("../src/march_10.jl")
# no functions, all in global scope
end
module march_18
include("../src/jan_31.jl")
# no functions, all in global scope
end
module march_25
include("../src/march_25.jl")
main()
end
I put everything in their own module to avoid name clashes and redefinitions of structs like Economy
. I don’t want the scripts themselves to be module ... end
because they are just sketches and meant to be used interactively.
Does anyone have any ideas for good patterns / best practices here?