Olympus
Paradigm(s) | imperative |
---|---|
Designed by | Daniel Temkin |
Appeared in | 2022 |
Computational class | Turing complete |
Reference implementation | Olympus |
Influenced by | INTERCAL, the Homeric Hyms, half-remembered episodes of Xena: Warrior Princess |
File extension(s) | .olympus |
In Olympus, we code in incantations to the gods -- it better reflects the actual power dynamic of programmer and machine. In this language, the virtual machine is Olympus itself. Instead of registers, we have a set of gods, each of which will do specific things for us if we ask them in the right way.
Concept
We command machines as if they were are servants, and yet they often do not do what we want. Olympus is a new programming language which better reflects the actual power dynamic of programmer and machine.
When we bark orders at digital assistants (our Alexas and Siris), it does not bring out the best in us. We become masters to insolent machines that continually misunderstand us; they are personified, usually as female service workers, which makes our position as masters all the more uncomfortable. Were we to write code in this way, it would make things even worse, given the "complete and unambiguous explanation" required in code; the micro-managing necessary enhances the sense of condescension.
But what if we reversed that power dynamic? When we pray, we also make requests- - often equally petty -- only we do so with great solemnity and respect. The language Hellenic adopts this approach. To avoid any sense of micromanaging the gods, we make requests in small pieces, each accompanied with appropriate praise. Like code itself, prayer is highly formalized speech, allowing for a pseudonatural style.
Zeus and Athena are great strategists, useful for command flow; Mnemosyne is the mistress of memory; we leave garbage collection to Hades. Zeus needs more praise than Athena, who is less likely to hold a grudge. Piss off one of the gods by asking for the unreasonable, and they might not follow any of our commands from that point on.
Influences
INTERCAL first introduced the idea of the interpreter as a sometimes-disapproving critic of code. Don't include enough PLEASEs and the program is ignored; write PLEASE too much, and it is ignored as well. In the original INTERCAL-72, the correct ratio of PLEASEs was not made public, meaning the programmer had to adjust one way or the other until the program would complete. This personifying of the interpreter and the reversed power dynamic of code are made more visible in Olympus.
Building a Program
Each line of code is written as an invocation: a request to a god. The request is not to immediately carry out a task, but rather to create or append to a named function. The invocations need be ordered to not offend the gods, which may mean a single function might be described in non-contiguous invocations. It is best to keep functions very small; every loop or branching condition must be its own function so we can describe it in pieces.
An invocation has three parts: the god's name and adoration (praising of that god), supplication to show the humbleness of the asker, followed by a request to add one or several of what we ordinarily call "commands" to the program.
An invocation can ask for more than one command, but the right amount of adoration is required. A heavier ask requires more adoration, and some gods need more than others. Adoration comes in the form of epithets, phrases that celebrate that god such as "goddess who grants the gift of abundance" for Demeter or "well-honored in Thrace and in Scythia" for Ares.
Do not ask the same god for two things in a row. Do not use the same epithets in a rote, repetitive way, and do not let any one god carry too much of the burden, else they may lose patience with you.
Anything with a name and no description is assumed to be a procedure (a function).
A check is a branching instruction. Its condition can be described separately and is always another function with a true/false return type.
Gods
Mnemosyne
is the mistress of memory. Anything dealing with assignment or declaring new variables goes to her.Hades
collects the souls of abandoned variables. All variables in Olympus that have mutability (the non-eternals) and primitives must be freed at the end. It is customary (and a good safeguard) to call on Hades to free all variables at the end of a program.Zeus
andAthena
are the strategists. They deal with the structure of code. Since they are called on quite a lot, the programmer has two to call on. Athena needs less praise than Zeus, she is less egotistical. They are equally powerful.Artemis
andDemeter
, who rule over the cycles of nature, are the masters of looping structures and repetition. Loops—for
orwhile
—are theirs. Functional calls that are loop over a list (e.g.map
/reduce
) also go to them.Ariadne
, mistress of the labyrinth and the serpent, deals with branching structures. That isif
,case
,break
, and the calling of a function.Hermes
, the bringer of dreams, is responsible for all random numbers. He is also the messenger of the gods, and deals with input and output. Like Ariadne, Hermes can make calls to functions.Aphrodite
, the goddess of desire and love, deals with currying. She helps a function spawn a child function (through currying). She also helps transform from the ideal plane into the physical world: any text can itself become code through her (eval).
Example Programs
99 Bottles
Come, happy, deathless Gods! Hearken to my prayer! Great and good Athena, purger of evils, who hears all words spoken in market and assembly, please make a function called printBot for parameter n that prints n, beerStr, and " on the wall!\n". Ariadne, pure one, ancient one, mistress of the labyrinth, wise and cunning one whose agile mind finds purchase on the frailest of notions, I beg you to create a check called check_ ninetynine with parameter x to call printBot with parameter x. O Mnemosyne, holder of tales old and new, mistress of memory, if in the past you have looked favorably upon me, I ask that you create a vessel called beerString and place within it the missive "bottles of beer". Ariadne, ancient one, pure one, mistress of the labyrinth, please give check_ninetynine a condition for parameter n where n is less than ninety-nine. Mindful Mnemosyne, by whom the soul with intellect is joined, I ask you to create a vessel called noMoreBeerString and inscribe it with "no more bottles of beer". Lord Zeus, master of storms, father of the gods, defender of cities, defender of homes, defender of the travelers and of those far from home, I beg you to create a function called printBeerInsideLoop for parameter n that prints n, beerString, " on the wall", n, beerString, ".\nTake one down, pass it around, ". Cyllenian Hermes, son of Zeus, messenger of Olympus, lord of Cyllene and Arcadia rich in flocks, I ask you to make a function called printBeerOutsideLoop that prints "No more bottles of beer on the wall!\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.". Ariadne, pure one, ancient one, mistress of the labyrinth, wise and cunning one whose agile mind finds purchase on the frailest of notions, please make function beerLoop for parameter x that calls check_ninetynine with parameter x. O Hermes, the Slayer of Argus, giver of grace, giver of good things, I implore you to add to beerLoop a call to printBeerInsideLoop with parameter x. Artemis, fostered with Apollo, virgin who delights in arrows, far-shooting goddess, who swiftly drives her all-golden chariot through Smyrna to vine-clad Claros, I ask that you establish a loop counting from ninety-nine to one called beerLoop. Hermes, the Slayer of Argus, giver of grace, giver of good things, please create a call to printBeerOutsideLoop. Hades, thy realm an earthy tomb, remote from mortals in their fleshy bust, thy throne is fixed in the dismal plains, I implore you to collect all variables that remain, stranded in the functions of Chion or in the main sequence to live on in your netherworld. O great Gods, with all the splendor of Olympus, sing the song of 99 bottles of beer on the wall!