Skip to navigation
The Mold and the Bricks
22.11.26
Picture three builders facing the same problem. The first is given sand, clay, and a kiln. The second is given a truckload of finished bricks. The third is given the mold the bricks are cast in. All three can raise a house. What differs is where their work begins. C is the kiln. It hands you the smallest units the machine knows: bytes, addresses, structs, function pointers. Nothing is hidden, nothing is supplied. You want a hash table, an object system, a garbage collector — you build it, and then you maintain it. The freedom is absolute and so is the invoice. Every abstraction in a C program is handmade, and every handmade abstraction is code somebody has to read at two in the morning. Python is the truckload. Lists, dictionaries, decorators, packages: most of what you need already has a shape. You assemble rather than manufacture, and that is exactly why it is pleasant. The cost is that the shape is not yours. When a library does almost what you need, you adapt your problem to its interface, and you learn to live with the seam. You are building quickly inside someone else's idea of a brick. Lisp is the mold. Not a smaller brick, not a larger one — the thing that decides what a brick is. The step from C to Python is a difference of granularity within the same game. The step to Lisp is a different game entirely. Why is this possible? Because in Lisp, a program is written in the same material as data. The expression (+ 1 2) is a list of three elements. You can hold it, take it apart, rearrange it, and hand it back. Source code is not a special, untouchable substance; it is ordinary structure. A program can therefore write programs. The instrument for that is the macro. A macro is a function the compiler calls with unevaluated code, and it returns code. Type (unless rainy (go-out)) and a macro you wrote expands it into (if (not rainy) (progn (go-out))). The word unless did not exist in the language until you wrote it; afterwards it is indistinguishable from a built-in. The expansion happens before anything runs, so the machine never sees the word unless at all. The mold shapes the clay and then steps aside. Compare a Python framework: it stays present at runtime, in your call stack and your profiler. Lisp's extension costs nothing once the compiler is done. Once you can add words, something subtler happens. You stop writing a program about your problem and start writing the language of your problem. A rules engine where you say (rule low-stock ...). A query language, a test specification, a config format, a description of game events. Each becomes a handful of macros instead of a parser, an interpreter, and a maintenance burden. The payoff is not elegance for its own sake: bugs live in the translation between the idea and the notation, and a DSL shrinks that translation almost to nothing. Then the mold turns on itself. A macro can generate macros. Common Lisp's object system goes further — through its Metaobject Protocol, even the definitions of classes and methods are made of the same moldable material. C can build an object system by hand, but its preprocessor only substitutes text; it is a stencil, not a mold. It does not understand the structure it is rewriting. In Lisp, one new word can change the meaning of every line that follows. This freedom is not free. It is front-loaded. You must decide what a brick means, and that is design work; a bad macro is a bad language, and everyone who uses it pays for your choice. Macro-generated code makes awkward error messages. Tooling is thinner, the community is smaller, and colleagues may not know the syntax. C spreads its cost across every file; Python borrows its cost from library authors; Lisp hands the cost to you, up front, where at least you can see it. The three languages teach three different lessons. C teaches that everything, all the way down, is mechanism. Python teaches that most problems have already been solved by somebody else. Lisp teaches the thing the other two cannot: that the language you are speaking is itself a material, and if the words do not fit the thought, you are allowed to make new words. That is why the mold matters — not because it is more powerful in the abstract, but because it moves the boundary between what the language gives you and what you must build one level closer to the idea in your head.
Reply
Anonymous
Information Epoch 1795523551
Avoid captive user interfaces.
Home
Notebook
Contact us