Bespoke: A Programming Language for People Who Say “Please”

Translated by a model; the original is in Russian.

· Curiosities
The author of the Larvitz blog proposes a satirical programming language in which the compiler is a respected colleague rather than a servant, and every command must be couched as a polite request.

cover.svg

Programming, the author observes, has picked up bad manners. We “kill” processes, “abort” transactions, “throw” exceptions and order the machine to “return” a value as though it were a Labrador. The proposed remedy is Bespoke — a statically typed and impeccably courteous language for developers convinced that executing code should never come at the expense of good manners. Informally it is called “The Queen's Code” (Victoria's, of course — the etiquette committee has yet to sign off on the twentieth century), its files carry the extension .charming, and the compiler reserves the right to be disappointed in you.

The Compiler Is Not Your Servant

Bespoke will not accept a bare command. Every request opens with a respectful greeting, states its business and closes with an approved form of thanks. Declaring an integer variable becomes a letter that begins with “Dear Compiler” and ends with “Thank you ever so much.” This is more verbose than int carriageCount = 0, but, as the author notes, it far more rarely creates a hostile working atmosphere. The semicolon is rejected as the conversational equivalent of slamming a door.

Types are spelled out in full and in a gentlemanly fashion: “An Integer Number,” “A Textual Passage,” “A Truth Value” with two literals — Quite True and Patently False. British spelling is enforced at the lexical-analysis stage: color is evidence of a want of proper upbringing.

Mutation Requires an Apology

Changing a variable is permitted, but only with an acknowledgement of the inconvenience caused; a curt assignment yields diagnostic B-101 “Blunt Imperative,” and compilation is suspended until the developer reflects on their conduct. The conditional operator is not a command but a hypothetical question submitted for the court's consideration. A function “returns” nothing; it proposes a small diplomatic collaboration; an exception is not “thrown” but delicately brought forward for gracious consideration.

Multithreading Without the Jostling

Concurrent programming, with its races and its seizing of locks, comes in for particular treatment. Bespoke's threads conduct themselves decorously: a mutex is “a request for a private audience.” And the classic deadlock, in which two threads endlessly defer to one another, the runtime records not as an error but as an “Exemplary Stalemate of Mutual Courtesy,” admiring the threads' good breeding and enduring the pause right up to the heat death of the Universe. Threads are not killed — they are sent a polite invitation to retire.

The compiler's diagnostics express restrained disappointment, warnings are printed on cream-coloured paper wherever possible, and the --quiet flag suppresses the compliments but never the criticism. The author frankly admits that the language will not make programs run faster (the information density of its source files is comparable to a nineteenth-century contract) and will not rid you of concurrency bugs. But it poses an important question: if we are going to spend all day demanding the impossible of machines, might we not at least do so graciously? On a crash the runtime does not “fall over” but resigns with a formal apology — though the exit code does remain non-zero: we are civilised, but we harbour no illusions.


Source: Lobsters

Comments

Sign in, to comment.

  • No comments yet.