\emph{Literate programming}, introduced by Knurth, interleaves code and prose so that a program can be read as both executable and explanatory text. We propose \emph{literate execution}, which inverts this relationship: rather than embedding code within a static narrative, we treat documentation -- and other expository elements such as visualisations -- as first-class artefacts that can be computed alongside a running program and then integrated into a view of its execution. We explore this idea through Fluid, a programming language with a provenance-tracking runtime that records fine-grained dependencies between inputs and outputs. These provenance relationships can be surfaced as interactions that allow readers to explore how intermediate values contribute to a result. By integrating visualisation, provenance, and exposition, literate execution aims to make programs more explorable and self-explanatory, and explorable explanations easier to program.
翻译:Knuth提出的《文学编程》(Literate Programming)将代码与文档交织,使程序既可执行又具可读性。本文提出《代码可读执行》(Literate Execution),通过反转这一关系:不再将代码嵌入静态叙事,而是将文档——以及可视化等其他展示元素——视为可与运行程序协同计算的第一类制品,并将其整合至执行视图中。我们通过Fluid语言验证该理念,该语言运行时系统通过溯源追踪记录输入与输出间的细粒度依赖关系。这种溯源关联可转化为交互式呈现,使读者能探索中间变量如何影响最终结果。通过融合可视化、溯源机制与展示说明,代码可读执行旨在构建更可探索、自解释的程序,并降低可探索式解释的编程复杂度。