An exploratory workflow with a main.jl file which calls different scripts with include is a very good / acceptable workflow.
If you are only working with a single file then you want to use Revise.jl’s includet, which means you dont have to run include all the time.
But you should really be trying to put everything in functions.
Here’s what I do.
- Start out with
main()at the bottom of your script. - Use
includeton that file and callmain()when you want to run everywhint - Write everything in
main, when it gets too big, break things into smaller functions that are called withinmain - Use
Exfiltrator.jlextensively in debugging, as@exfiltrate; error("")when you want to break and send everything in that function’s local scope to global scope for inspection at the REPL - Use dictionaries, named tuples, and custom structs to store information. Pass large objects to the functions and use
@unpackto work with just the things you need. This means you don’t have to agonize about what you are and are not passing to your sub-functions. - Just run
main()all the time. If you useincludetthen everything will always be up to date. It’s very freeing.