The discussions here remind me of something that’s occurred to me a few times. I’ve often used a notebook (both Jupyter and Pluto) to do some exploration, and then later regretted it somewhat. In the case of Jupyter because of the out-of-order pitfalls that are well known, and in the case of Pluto because while the reactivity is a really awesome feature, I’ve found it can be a bit difficult to factor out code that belongs in an extra-notebook form (file to be include
’d, or even a package). Usually it seems easier to just start with another blank notebook and manually put back only what needs to be there to create the ideal reactive document. That’s not a knock on Pluto at all, BTW, just a confession that I’m probably abusing it!
By contrast the vanilla REPL doesn’t have the reactivity ‘potential for abuse’ of Pluto or the out-of-order problems of Jupyter, but of course lacks many of the nice features of both Jupyter and Pluto (mini-IDE in each cell with syntax highlighting, etc; ability to have rich text annotations, even including LaTeX; inline interactive plots; …).
Anyway. My point actually isn’t that either Jupyter or Pluto should change much, or at all, but that I wonder if there is kind of another complementary approach that could be taken.
What if there was something that behaved like the REPL in that you could not execute things ‘out of order’ but only recall previous entries as you can with the REPL with the up arrow (and Ctrl+R etc). Basically simply Jupyter but with only the ability to append cells and allow the same kind of workflow as I think a lot of us do in the REPL:
julia> f(x) = x + 2 # first swing at how f should work
f (generic function with 1 method)
julia> f(2)
4 # wait, that's not right...
julia> f(x) = x - 2 # oh yeah it should have been this instead
f (generic function with 1 method)
julia> f(2)
0 # hmm, that's still not right ...
.
. # rinse, repeat..
.
julia> f(x) = x^3
f (generic function with 1 method)
julia> f(2)
8 # that's it, time to copy and paste f into a .jl file!
At this point, especially in the creation of ‘scripts’ (more so the users, especially novice, of Julia as opposed to, typically more experienced, package developers), a common pattern would be to copy-paste one’s terminal history to a file and then manually scroll through and remove lines that were dead-ends, likely making mistakes in doing so, resulting in going back to the REPL and manually replaying the process etc,.
So imagine each julia>
prompt is more like a Jupyter or Pluto cell with all the mentioned advantages, but where you can press the up arrow to recall, change, and re-execute.
Now where I wonder if the great technology that Pluto has developed could come in: what if this tool could automagically flag prior cells that become invalid because of later entries? Such that you could just press a button and have such now-invalid cells are removed, and get out a minimal history resulting in the final workspace, with whatever methods have resulted and global scope results that have resulted. Then you have reproducibility (another Pluto advantage) but always being able, and indeed required, to be read top-to-bottom, Which addresses, I think, some of the concerns of using both Pluto and Jupyter, especially in some teaching contexts (including self-teaching).
In terms of implementation (and to be clear I personally am nowhere near skilled enough to do so so this is so far maybe at best a thought experiment) clearly this would be best implemented by taking parts of both Jupyter and Pluto and factoring these out to separate packages depended-on by both of these tools, which of course would take some effort and involve a certain amount of cooperation on the part of maintainers of both projects, but at least wouldn’t have to involve an all-out fork of either project, the downside of which I think are what’s behind some of what is being discussed here and elsewhere in regards to the OP’s project.
So, just an idea, which maybe has been substantially proposed and maybe even in part done before (some Juno/VS Code functionality intersects) but I thought I’d put it out there.
Finally, I think every post about Pluto, Jupyter, and such tools that make Julia more accessible and useful should conclude with sincere thanks to the authors of these!