Quilt in the language that processed every paycheck in the 20th century. COBOL was designed in 1959 by a committee of people who wanted a language that businesspeople could read. They gave it divisions — IDENTIFICATION, ENVIRONMENT, DATA, PROCEDURE — each one a separate layer of the program. When you express the Quilt cell model in COBOL, the cells don't just have types; they have layers. The hierarchy is in the language, not in your code.
Why • Philosophy • What works • Workarounds • Deeper understanding
The cell model — a typed unit of state with a name, a value, and a way to recompute it — predates the spreadsheet. It predates the relational database. It predates the personal computer.
In 1959, a committee of businesspeople, computer scientists, and government representatives designed a language for the US Department of Defense. They wanted a language that could process payroll, manage inventory, and run the world's ledgers. They called it COBOL — Common Business-Oriented Language. And they gave it a structure that maps to the cell model in a way no other language does.
The structure is divisions. The IDENTIFICATION DIVISION says who the program is. The ENVIRONMENT DIVISION says where it runs. The DATA DIVISION says what data it holds. The PROCEDURE DIVISION says what it does. Four layers, each with its own rules, each with its own purpose.
A Quilt cell in COBOL is not a struct. It is a data item in the DATA DIVISION, with a paragraph in the PROCEDURE DIVISION that knows how to compute it. The reactive engine is a paragraph that says "go recompute the dependents of this data item." COBOL programmers were doing reactive cells in 1960. They called them records and paragraphs.
This repo is the polyformalism port of Quilt to COBOL. The same model, expressed in the language that is older than most languages — and still running the world's banks, airlines, and governments. The polyformalism insight: the cell model is older than spreadsheets; COBOL programmers were doing it in 1960.
The Quilt model is language-independent. A cell is a typed unit of state. A formula is a function over dependencies. A listener is a callback. A sheet is a graph. The polyformalism question is: what does the model look like in a language designed for business, not for science?
The COBOL version emphasizes:
- Layered data items. The DATA DIVISION has a hierarchy.
WS-INCOMEis a record.WS-INCOME-AMOUNTis a sub-field. The hierarchy is the cell tree. - Paragraphs as formulas. The PROCEDURE DIVISION is a series of paragraphs. Each paragraph is a formula. A
PERFORMstatement is a function call. - No closures, no first-class functions. A formula in COBOL is a named paragraph, not a lambda. The reactive engine is
PERFORMchains. - The hierarchy is in the language. COBOL's data items are nested by convention (
WS-SHEET-CELL-VALUE), not by syntax. But the nested structure is there, in the names. - The business community has been doing this for 60 years. COBOL is the language of the world's ledgers. The polyformalism insight: the cell model is the ledger model, and COBOL is the language of ledgers.
The polyformalism insight: the cell model is older than spreadsheets. COBOL programmers were doing it in 1960. VisiCalc came in 1979. COBOL's hierarchical records with paragraph-driven recomputation came in 1960. The model is the same; the spreadsheet just made it visual.
COBOL's data items are layered. A 01 level is a record. A 05 level is a sub-field. A 10 level is a sub-sub-field. The cell tree is the data tree.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-SHEET.
05 WS-CELLS OCCURS 100 TIMES.
10 WS-CELL-PATH PIC X(32).
10 WS-CELL-KIND PIC X(8).
88 WS-KIND-VALUE VALUE 'VALUE'.
88 WS-KIND-FORMULA VALUE 'FORMULA'.
10 WS-CELL-VALUE PIC 9(13)V99 COMP-3.
10 WS-CELL-DEPS PIC X(128).WS-SHEET is the sheet. WS-CELLS is a table of cells. Each cell has a path, a kind, a value, and a list of dependencies. The OCCURS 100 TIMES makes it a 100-cell sheet. The polyformalism insight: the cell model is a table; COBOL is a table language.
Polyformalism insight: the sheet in TypeScript is an array of objects. In COBOL, it's a OCCURS clause. The shapes are the same. The polyformalism insight: the sheet is a table in every language.
A formula in COBOL is a paragraph. A PERFORM statement invokes it. The reactive engine is a PERFORM chain.
PROCEDURE DIVISION.
0000-MAIN.
PERFORM 1000-READ-INCOME
PERFORM 2000-READ-EXPENSES
PERFORM 3000-COMPUTE-SAVINGS
PERFORM 9000-DISPLAY
STOP RUN.
1000-READ-INCOME.
MOVE 5000 TO WS-INCOME.
2000-READ-EXPENSES.
MOVE 3000 TO WS-EXPENSES.
3000-COMPUTE-SAVINGS.
COMPUTE WS-SAVINGS = WS-INCOME - WS-EXPENSES.1000-READ-INCOME is a paragraph. 3000-COMPUTE-SAVINGS is a formula paragraph. The polyformalism insight: a formula in COBOL is a paragraph; a paragraph in COBOL is a formula.
Polyformalism insight: the formula in TypeScript is a function. In COBOL, it's a paragraph. The shapes are the same. The polyformalism insight: formulas are functions, regardless of whether the language calls them that.
COBOL's level numbers (01, 05, 10, 15) are the cell tree depth. A 01 is a sheet. A 05 is a cell group. A 10 is a cell. The hierarchy is in the syntax.
01 WS-FINANCIAL-SHEET.
05 WS-INPUTS.
10 WS-INCOME PIC 9(13)V99 COMP-3.
10 WS-EXPENSES PIC 9(13)V99 COMP-3.
05 WS-DERIVED.
10 WS-SAVINGS PIC 9(13)V99 COMP-3.
10 WS-RATE PIC 9(3)V9(4) COMP-3.WS-FINANCIAL-SHEET contains WS-INPUTS and WS-DERIVED. WS-INPUTS contains WS-INCOME and WS-EXPENSES. The hierarchy is in the level numbers. The polyformalism insight: the cell tree is the data tree; the language knows.
Polyformalism insight: the cell hierarchy in other languages is a runtime structure (a dict, a class). In COBOL, it's a syntactic structure (the level numbers). The compiler knows the tree; the runtime doesn't have to walk it.
A COPYBOOK is a COBOL file that defines a data structure. Other programs can COPY it. The cell model has cell kinds, and each kind has a COPYBOOK.
* copybook value-cell.cpy
01 VALUE-CELL.
05 VC-PATH PIC X(32).
05 VC-VALUE PIC X(64).
* copybook formula-cell.cpy
01 FORMULA-CELL.
05 FC-PATH PIC X(32).
05 FC-DEPS PIC X(128).
05 FC-COMPUTE PIC X(8).
88 FC-SAVINGS VALUE 'SAVINGS'.
* main program
DATA DIVISION.
COPY 'value-cell.cpy'.
COPY 'formula-cell.cpy'.
01 WS-CELLS.
05 WS-INCOME COPY VALUE-CELL.
05 WS-SAVINGS COPY FORMULA-CELL.The COPY statement imports a cell schema. The cell model is a library of COPYBOOKs. The polyformalism insight: a cell kind is a COPYBOOK; a sheet is a program that COPYs them.
Polyformalism insight: the cell kind in Pydantic is a Pydantic model. In COBOL, it's a COPYBOOK. The polyformalism insight: cell kinds are schemas, regardless of whether the language calls them that.
COBOL is verbose. The 01 and 05 and 10 levels look excessive. But the verbosity is the design: every level is a name, every name is documentation, every name is a place for the next person to read.
01 WS-QUILT-SHEET.
05 WS-QUILT-INPUTS.
10 WS-QUILT-INPUTS-INCOME PIC 9(13)V99 COMP-3.
10 WS-QUILT-INPUTS-EXPENSES PIC 9(13)V99 COMP-3.
05 WS-QUILT-DERIVED.
10 WS-QUILT-DERIVED-SAVINGS PIC 9(13)V99 COMP-3.
10 WS-QUILT-DERIVED-SAVINGS-RATE PIC 9(3)V9(4) COMP-3.
05 WS-QUILT-LISTENERS.
10 WS-QUILT-LISTENERS-ON-SAVINGS PIC X.WS-QUILT-DERIVED-SAVINGS-RATE is the full path. There is no ambiguity. There is no short-name collision. The polyformalism insight: the cell's path is the cell's name; the language forces it to be a complete name.
Polyformalism insight: in dynamic languages, the cell path is a string. In COBOL, it's a name. The compiler checks uniqueness, the linker checks references, and the next person reading the code can grep for the name.
COBOL has no closures. A paragraph has no captured state. All state is in WORKING-STORAGE (global data).
Workaround: Use LINKAGE SECTION parameters. A paragraph takes its inputs and outputs as parameters, and writes the result to a parameter. The reactive engine is a series of PERFORM calls with parameter passing.
3000-COMPUTE-SAVINGS.
MOVE WS-INCOME TO LS-INCOME.
MOVE WS-EXPENSES TO LS-EXPENSES.
PERFORM 3100-FORMULA-SAVINGS.
MOVE LS-RESULT TO WS-SAVINGS.
3100-FORMULA-SAVINGS.
COMPUTE LS-RESULT = LS-INCOME - LS-EXPENSES.Insight gained: closures are syntactic sugar for "a function with state." COBOL doesn't have the sugar, but the model is the same — you have a state and a function over that state. The polyformalism insight: the function-with-state pattern is universal; the language decides whether you can write it on one line.
You can't pass a paragraph as a parameter. You can't store a paragraph in a data item. A formula is a named paragraph, called by name.
Workaround: Use a SWITCH (a 1-byte flag) to indicate which formula to run, and a PERFORM with a conditional name. Or use a table of paragraph names and CALL them dynamically (with CBL_CALL extensions).
Insight gained: the cell model doesn't actually need first-class functions. It needs named functions. COBOL has those. The polyformalism insight: first-class functions are a convenience, not a requirement.
COBOL has GO TO. Everyone knows it shouldn't be used. But the reactive engine is, at its core, a GO TO chain — jump to the recompute paragraph, jump to the listener, jump to the display. COBOL programmers are forced to confront the fact that reactive engines are state machines, and state machines are GOTOs.
Workaround: Use PERFORM (the structured version of subroutine call) for the formula chain. Use GO TO only for the actual state machine transitions.
Insight gained: the GOTO stigma is real, but the cell model uses it anyway. The polyformalism insight: reactive engines are state machines, and Dijkstra's "GOTO statement considered harmful" was right — but the alternative is a state machine library that does the same thing with more ceremony.
COBOL has no JSON. Records are fixed-format. Data interchange is done with comma-separated files or fixed-width text.
Workaround: Use XML PARSE or JSON PARSE extensions in modern COBOL (GnuCOBOL has them). Or generate JSON with STRING statements, field by field.
Insight gained: the cell model in 1960 was a fixed-format record. The polyformalism insight: JSON is a 2000s idea; the cell model is a 1959 idea.
After implementing Quilt in COBOL, the following insights emerge:
-
The cell model is older than the spreadsheet. VisiCalc was 1979. COBOL's records with paragraph-driven recomputation were 1959. The polyformalism insight: the cell model is older than the spreadsheet; spreadsheets just made it visual.
-
Hierarchy is the data structure. COBOL's level numbers are the cell tree. The reactive engine walks the tree. The polyformalism insight: the cell model is a tree; COBOL is the language that makes the tree explicit.
-
Verbosity is documentation. COBOL is verbose. The verbosity is the documentation. The cell path is the cell name. The polyformalism insight: verbose languages force you to name everything; named things are easy to find.
-
The business community has been doing this for 60 years. COBOL is the language of the world's ledgers. The polyformalism insight: the cell model is the ledger model, and the world's ledgers are running on it.
-
The reactive engine is a paragraph chain.
PERFORM 1000-READ-INCOME. PERFORM 3000-COMPUTE-SAVINGS. PERFORM 9000-DISPLAY.The chain is the engine. The polyformalism insight: the reactive engine is a sequence of named operations; COBOL calls that a paragraph. -
The polyformalism is about history. Other languages reveal different facets of the cell model. COBOL reveals the historical facet. The polyformalism insight: the cell model has been with us for 65 years; COBOL is the language that shows us the original.
🏦 Bank ledger integration — A bank runs a COBOL ledger. The Quilt sheet is the ledger. The cell tree is the account tree. Formulas are the interest computations. Listeners are the regulatory reports. The polyformalism insight: the cell model is the ledger model, and COBOL is the language of ledgers.
🏛️ Government compliance — A government agency runs a COBOL compliance system. The Quilt sheet is the regulation tree. Cells are the regulations. Formulas are the applicability rules. Listeners are the audit triggers. The polyformalism insight: the cell model is the regulation model, and COBOL is the language of government.
📊 Insurance actuarial table — An insurance company runs a COBOL actuarial system. The Quilt sheet is the risk table. Cells are the policyholders. Formulas are the premium calculations. Listeners are the claim triggers. The polyformalism insight: the cell model is the actuarial model, and COBOL is the language of insurance.
quilt-cobol is the business legacy layer of the Quilt polyformalism stack. The full set of 12 languages:
| Language | What it reveals | What needs workarounds |
|---|---|---|
| TypeScript (canonical) | Reactive evaluation is natural | Hides the state machine structure |
| Tutor (1970) | Multi-user cells are the default | No closures, no async, no nested data |
| Pydantic-AI (Python) | Type safety is the runtime contract | Async overhead, slow interpreter |
| Mojo | Cells are types, not values | Young language, moving target |
| Julia | The reactive engine is a type system | No first-class sheets, compile latency |
| Chapel | Cells are inherently parallel | Verbose syntax, small ecosystem |
| COBOL (this) | Hierarchical cells map to divisions; the model is older than spreadsheets | No closures, no first-class functions |
| C | The mathematical core | No reactivity, just procedure calls |
| C++ | Type-erased cell kinds | Templates explode |
| C# | The enterprise-friendly version | Heavy runtime |
| Metal | GPU-evaluated cells | Host-device split |
| Swift | Actors = cell isolation | Verbose for simple sheets |
The COBOL version is for the business legacy — the case where the cells must interface with a system that has been running since 1960. The cell model is the same; the audience is different.
If you've ever wondered what a reactive engine looked like before spreadsheets. If you've ever wanted to see the cell model in the language that processed every paycheck in the 20th century. If you've ever wanted to know what a "value cell" was called in 1960.
This is for you.
COBOL is the language that says: the cell model is older than you think. The hierarchy is older than you think. The reactive engine is older than you think. The polyformalism insight: we are not inventing a new model; we are rediscovering an old one.
Apache 2.0. See LICENSE.
The cell was a record. The formula was a paragraph. The reactive engine was a PERFORM chain. COBOL has been Quilt all along.
