So I frequently hear that Julia is supposed to be interactive, where you work mostly in the REPL:
Julia’s REPL provides rich functionality that facilitates an efficient interactive workflow.
The most basic Julia workflows involve using a text editor in conjunction with the
It used to be the weirdest thing to me, since I kept using the REPL literally from the terminal. So I quickly switched to Jupyter and Pluto notebooks for Julia development.
Recently it struck me that R is used “from the REPL” too: in RStudio, you write code in a file, Shift+Enter to run a block of code and observe results either as plots or as printouts in the bottom panel. However, the bottom panel is the R REPL! Shift+Enter simply dumps lines of code in there, so working in RStudio is working “in the REPL”, all the time. Right?
The Julia VSCode extension lets me do the exact same thing:
- Write code.
- Shift+Enter to evaluate an expression.
- The code I want to evaluate is dumped into the Julia REPL and then executed.
- Observe results as plots or printouts. I even set up the same editor layout as in RStudio: code to the left, plots to the right, the terminal is the bottom panel.
- Rinse and repeat.
The main benefit compared to working in the terminal is that you have a Julia file where you write and evaluate your code. You get language server support, highlighting, and the code is automatically saved. I mean, this is a full-fledged IDE, so tons of features.
Is this comparison with R and RStudio valid? Is this an efficient way of using Julia, besides notebooks? I feel like this is exactly what the Julia VSCode extension was made to support.
This seems to work well for “exploratory programming”, where you write random code to test out ideas. Equipped with this workflow, I’ve just spent two full days designing an API for a future package, and it was kinda fun and I actually made a lot of progress with relative ease, for the first time with Julia and a text editor. …even though I’ve been writing Julia in the terminal and notebooks for about two years now, so I’m not exactly new to Julia itself.