In the process of iterating through lots of toy economic models and writing small scripts to analyze them (make plots, etc.).
I’ve gotten into the following workflow, and I’m wondering if (a) it’s reasonable (b) Other people share it and (c) if other people have formalized it into a package.
The workflow attempts to balance the ease of running a script at the REPL with
- use
] generate MyModel
because ultimately I will want things in a package ] add
a bunch of packages- Write my functions inside the
MyModel
module - Write a
main
function insideMyModel
- In the REPL, run
using Revise; using MyModel; exportall(MyModel)
. The last command sends all names toMain
- Make
main
look like this
function main()
@eval Main begin # everything available at the REPL
...
end
end
- Go to
src/MyModel.jl
and copy and paste all theusing
statements into the REPL so that everything is available at the REPL. - Run
main()
at the REPL. Everything insidemain
is visible. - Use
@infiltrate
extensively while debugging.
The reason for main
with @eval
is so that I can take things inside main
and easily spit them out into helper functions that are also in the MyModel
module.
This gives me the best balance of having a package and having stuff accessible at the REPL.
Anyone else do this? I use Sublime Text and a terminal, btw.