A Core Calculus for Documents (2024)
22 points by typesanitizer
22 points by typesanitizer
The distinctions between document languages as {String, Article} x {Literal, Program, Template Literal, Template Program} would have been very helpful in some of the discussion on The Only Two Markup Languages (by @gingerBill). For example, that article's title is referencing syntaxes for Article Literal documents, which are fundamental to Article templates since they will need some form of syntax for basic literals. Although the discourse on "arbitrariness" of the syntaxes is still unique. Section 7.2 (pg 26) discusses some more concerns for concrete syntax.
I also appreciate the discussion of strategies for flattening nodes in a template's foreach implementation. I want to mention that while Typst is listed under the "flattening the IR later" strategy, I would argue that it actually makes use of "quote unsplicing" as well. Typst does the former in its realization phase alongside what the article calls "reforestation" (interpreting show and set rules), but it employs quote unsplicing earlier in the evaluation phase by having curly-braced blocks and for-loops automatically join their contents, e.g. { {a; b}; c } produces a flat list of a, b, c even before realization.
Finally, I have been thinking for a while that code formats—IR-based, textual, and assembly/machine code—are in many ways documents for compilers that treat their input language as a kind of "Article Literal". It would be very interesting to compare optimization passes in compilers with template or macro systems in document languages.
Timely! I've recently been working on a very PL-theoretic templating language.
Is there any equivalent calculus for applications in general, that apply to native (CLI, TUI, GUI..) as well as web applications equally well? It'd be quite relevant with this discussion..
I've followed Will because of Nota and Bene, as I'm somewhat "obsessed" about the "perfect" document preparation system and these looked promising... but I believe these two projects have been dormant for a while.
Did anything interesting come out of this paper?
I do worry that these rigidly-designed systems will have no ability to present information that is an exception to those rules. And all sufficiently old/complex/corporately-edited documents will have exceptions.
These efforts remind me of the international effort during the 1990s-2000s, somewhat akin to the OSI model, to develop the once-and-for all technical document structured binary format. It has sunk so completely from view that I can find no records of it.