hn.today

Missing Tools of Literate Programming

pratik.deoghare.com4 points0 comments
Screenshot of Missing Tools of Literate Programming

Literate programming separates code written for human understanding from executable code: weaving produces a document, while tangling generates source files. The usual tools leave a gap when a compiler reports an error in tangled code, because its location does not point back to the literate file. A sourcemap could record how lines in each file correspond, enabling both error navigation and an “absorb” tool that transfers edits made to generated code back into the literate program without adding markers to the source. Once edits can flow both ways, simultaneous changes create conflicts. A watcher could log changes, and a sync tool could use the log and sourcemap to merge edits and present conflicts for resolution, much like Git. The files need not be rewritten continuously while someone types, and a complex CRDT is unnecessary for changes on one machine.

The same approach could make literate programming easier to adopt across teams: AI could convert an existing codebase into literate files, with tangling required to reproduce the original code exactly. Team members could maintain personal literate versions while sharing the same executable output. A Go repository is offered with absorb, sync, watch, weave, and tangle commands, plus a Claude skill containing Python scripts. The author says the generated tools and code have not yet been reviewed or tested, and treats AI-written explanations and literate documents as promising but unverified ways to improve understanding and provide more focused context for AI-assisted development.

Read on pratik.deoghare.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Solid 2.0

Solid 2.0

Solid 2.0 is now stable, five years after version 1.0, with a smaller API and diagnostics designed for AI agents. Its reactive graph now handles asynchronous computations, while built-in server functions support RPC calls and persistent Server-Sent Events connections. (solidjs.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.