To bake a Hello World Souffle requires exactly 114 g sugar, 111 ml beaten eggs, 54 ml double cream, and 32 g cocoa powder. Most recipes measure by the number of eggs, rather than their volume in milliliters, and do not opt for a level of specificity appropriate more for a chemistry lab than a kitchen. However, this recipe is not only for cooking, but also serves as a computer program in the Chef language.
Chef is one of the best-known esolangs to embrace multicoding: where content has different meanings when considered in different contexts. The term (as “multiple coding”) was coined by Michael Mateas and Nick Montfort in their “A Box, Darkly” (2005), the paper that first introduced many academics to esoteric and obfuscated coding practices. It uses the example of “Jean put dire comment on tap,” a phrase that holds very different meanings in French and English. Programs can be multicoded on a few different levels. Malicious programs are sometimes written with a gap between its reading by a human and its actual execution by the machine. In our previous post, we looked at the case of Primify, which multicodes numbers and images. Programs known as polyglots have a single text that holds multiple meanings even to the machine itself, functioning differently when interpreted in more than one programming language.
When Chef appeared in 2003, it joined a slowly growing list of esolangs that are explicitly multicoding, although this term was not one used by their creators (they are usually simply described as “designed to make programs appear to be something else”). Its author, David Morgan-Mar (interviewed here), created the cult esolang Piet the previous year. Where Chef’s programs multicode as cooking recipes, programs in Piet (pronounced “Pete”) are images, with commands defined by the change in hue or lightness between adjacent pixelly blobs of color, called codels. Shakespeare (created 2001) has as its programs, long, rambling stage scripts. Whitespace (2003) uses only tab, space, and return. In Whitespace, commands are multicoded as what is normally read as their absence. These characters are treated interchangeably by C and C-derived languages, meaning Whitespace programs can be embedded between words in these programs, creating polyglot programs that function in both languages.
There were few precursors for these languages in the early ’00s. Previous esolangs like brainfuck and Malbolge had unusual lexicons, but emphasized their puzzle-like logic. Multicoding languages don’t generally have unusual logical systems, most are straightforward, procedural languages behind their odd vocabularies. More recent multicoding languages, like AshPaper and bodyfuck, have benefited from these forerunners, learning the lessons of how Shakespeare commands are constructed as dialogue. But at the time Shakespeare was written, it was intended primarily as both joke and provocation. Its creators likely had little expectation that esoprogrammers would continue to work with these languages and learn from them decades later. Otherwise, there would be alternatives to Shakespeare’s repetitive “SPEAK YOUR MIND!” command. So it might seem unfair to overly critique their design decisions, but considering Chef’s design more deeply can give us insight into how multicoding schemes function and help consider possibilities in multicoding strategies for future works.
Chef’s Central Metaphor
Chef differs from Whitespace and Piet in the confluence of its central metaphor. While a cooking recipe might sound as arbitrary as the systems other esolangs use, it differs in that recipes already are algorithms. A recipe is a plan, worked out step by step: well-ordered, repeatable, and, given the expected input and faithful execution, produces the expected output. In fact, recipes have long held as an example of algorithmic thinking for non-programmers (see, for instance, the entry for Algorithm in the Simple English Wikipedia, which strives for simple explanations). Recipes, like other algorithms, break up continuous processes into discreet steps that can be carried out in an orderly way. In her Contingent Computation, M. Beatrice Fazi describes this systematizing of process as a “discretization of reality”: