Member-only story
Writing Code Without Plain Text Files
The Unison programming language doesn’t store code in files, but in a database. What is that like?

For about a week, I have had the unusual experience of writing code without the usual hierarchy of folders and plain text files that us programmers are accustomed to. Instead, my code has been living inside an SQLite database, stored as abstract syntax trees (ASTs). If you don’t know what an AST is, allow me to clarify. Consider a simple statement in a programming language such as:
y = 4 * (2 + x)
When you compile or interpret that statement, it will first be turned into tokens by a lexer which pass those tokens to a parser which tries to figure out the grammatical structure of the statement. The parser will produce an abstract syntax tree (AST) representing that statement. An AST is a tree-based data structure. The illustration below helps give you an idea.

Anything in source code can be represented as an AST. A function definition or a type definition will get parsed and turned into an AST. Depending on the language, this AST is also what is used to execute statements in the program or to produce the machine code that will get executed.
The particular programming language I have used, that chooses to store code in its compiled form, is called Unison. It is a pure statically typed programming language which might look familiar to anyone who has ever toyed with Haskell or another ML-like language such as OCaml, Standard ML or F#.
I am actually not particularly interested in that kind of language, being primarily a big fan of dynamically typed languages such as Julia and Lua. Yet for the last week I deliberately went ahead to learn Unison, despite not being particularly interested in it. So, why did I do that, and what was my experience?
The reason was specifically because I wanted to find out what non-file-based programming is like in 2023. It is not an entirely new concept. For instance, the Smalltalk programming language which dates back to the 1970s eschews file-based…