For my PhD, I explored an idea I call interactive functional programming, which combines live programming with self-explaining computation. In an interactive programming system, all execution is “differential”. Every interaction results in a specific delta to the program's execution history, allowing the debugging context to update into a new consistent state, rather than forcing us to choose between aborting the debugging session or continuing in an inconsistent state.
Although I did not attempt to produce an efficient incremental
implementation of this idea for my thesis, I was able to demonstrate an
approach that generates useful deltas. The figure to the right shows how
an execution of the recursive function sumSquares
is
updated retroactively when the definition of the function is modified.
In an implementation which is self-hosted, a system that executes differentially can be used to visualise differences in executions. One visualises a delta by simply computing the corresponding delta in the visualisation.
The image above was created in this way. The implementation generated
“before” and “after” visualisations of the execution
of sumSquares
, and then subtracted the “before”
visualisation from the “after” visualisation. In a practical
implementation both the computation and the view would be updated
incrementally.