If God.js Existed, What Would It Do?

As big software companies become more prescriptive in their terms of service, it's appropriate that three developers in Brooklyn are experimenting with the idea that natural-language rules can enforce themselves with software--the equivalent of modern-day, machine-readable scripture. “There’s this hype to teach people how to code and I feel like there’s no conversation,” says Ramsey Nasser. “What are the languages that we’re teaching people? What is instruction, what is behavior, what is data?”

Built during an Art Hack-day with the theme “God Mode,” the creation of God.js was inspired by the realization that computer code and religious text are both essentially instruction sets, each with a capacity to govern our lives. “I started thinking about religious scripture as instruction and how that relates to code and instruction,” says Ramsey Nasser, one of the three developers. The second, Ivan Safrin, says, “In the same vein, I was thinking about Terms of Service as instruction and as religion.”

They're looking at the fine line between information and instruction. While most of the programs we encounter were built to free us from our mundane tasks, there is another more prescriptive side to engineering--just look at most enterprise software--that can constrain us to a narrow path of approved behaviors. When we work by computer, we receive our instructions as human-readable text, rendered by code. The God.js project plays with idea that plain text itself could compile as instructions to limit the reader’s behavior in the browser, somewhat like the way real religious texts can bumper peoples' behavior in real life.

“There’s this hype to teach people how to code and I feel like there’s no conversation about what are programming languages,” says Nasser. “And what are the languages that we’re teaching people? And what is instruction, what is behavior, what is data? These things that coding specifies--we just take [them] for granted. Computer science is a really weird craft where you can remake all of the tools that you interact with. In theory, there’s nothing stopping you from rewriting everything down to the operating system. Nothing is set in stone.”

What It’s Like To Use A Godscript

I first encountered the project at 319 Scholes, a digital arts space in Brooklyn that hosted the Art Hack Day event and resulting exhibition, which yielded about two dozen projects from 50 artists and coders.

In the gallery, I approached a laptop on a pedestal, flanked by tall white candles and two iPads displaying the project description and samples of the God.js code, both written in Medieval-looking type and flowery language. I was instructed to select my “religion” from a set of three belief systems available in the God.js Chrome plug-in. Each one placed a unique set of constraints on my browsing behavior, doling out punishments for transgressions, such as visiting a page with too many obscenities.

I selected the religion developed by the second developer, Will Brand, and randomly pointed my browser to Gawker. Festering boils filled the page as clipart frogs rained down. Apparently the god behind this religion was not a Nick Denton fan.

“All the computer science in this project is real, it does actually run, it is a real programming language,” says Nasser, “but all the religion stuff is made up.”

The project is open source on GitHub, allowing anyone to write and publish their own religions. The group created a Chrome extension with a drop-down menu which allows you to choose to enforce any one of the published religions in your browser.

Each of the three developers wrote one religion, but halfway through the event, a fourth religion popped up. “One of the people who was at the show opened up his laptop and on GitHub, forked my religion, made his own, changed the name, and our Chrome extension picked it up,” says Nasser. “There was a schism in my religion. He had his own holy book that people could convert to.”

Nasser’s part of the project looked for instances of the word "java" on the page, which is a programming language that Nasser says he can't stand. When found, the word triggers 25 tabs of an animated GIF of hellfire.

Safrin says that most of the demonstrable code has to do with punishing the user for transgressing in one way or another in the browser. “My religion looked for profanities on the page; it gave you three strikes and upon the third strike, all your tabs shall be closed,” he intones. “It's funny, when we were showing the piece someone asked if we had tried taking existing scripture and running it through the compiler. It probably wouldn't work, but the way the language is designed, it's so abstract, you could possibly do something like that if you designed it for a specific type of scripture.”

Nasser, Safrin, and Brand are Brooklyn-based artist-coders who set out to make a statement about the nature of codified instructions, what they really mean, and how we are taught to take them at face value--without a second thought as to how or why things were designed that way, and by whom. One of Nassar’s recent projects, called قلب or "Alb," which means "heart," he says is the first fully functional programming language based on Arabic script. (Programmers from Asia or the Middle East must typically learn basic English and the Latin alphabet while learning to program.)

How Religious Texts (Sort Of) Function Like Code

“Our initial conversation revolved around things like ‘Is a function a book? Is God a class?’" says Nasser. “We were trying to find all these parallels between computer science ideas and these religious ideas--really bringing these infallible ideas and breaking them down and thinking, ‘Well, how can we represent this in a parser in a virtual machine? What does it look like in Javascript?’”

In the program, scripture is broken up into sentences and certain sentences will actually compile into functioning code. Say something like “Recite the book of Wrath” and the machine will look up a function called “wrath” and it will try to run that function. Any sentence that doesn’t parse into something meaningful for the user’s behavior is ignored by the compiler. “You could just embellish your code with ‘And we created the heaven and earth. And is it not perfect?’ That doesn’t do anything in the computer but it’s still present in the source text,” says Nasser. “The parallel that drew for me was reading religious scripture and trying to figure out what parts of it are actually meaningful and what parts of it actually affect your daily life; what parts are old stories or over-embellished narratives?”

The similarities are deeper. "Just the structure of scripture--you do see a lot of parallels between code and scripture,” says Safrin. “For instance, the Bible is divided into sections and everything is numbered, and kind of referential. That struck me immediately as very similar to what you see in code--how you have statement and assembly that are in specific parts of the memory and there's always references to specific numbers in memory,” he says. “That's very much the same in religious scripture: How it's sectioned off into parts that have specific numbers that you can reference. The way it reads is often very structured and mathematical. Sometimes it’s almost comical [how it] reads like execution code, more so than our language. I don't know if that's just an artifact of translation, but a lot of it does sound systematic.”

If anything, Nasser says, scripture reads like one language in particular. “There are some languages that try and read as English text,” he says, citing AppleScript, which was developed by Apple as an easy, readable, novice-friendly language. “To write code in AppleScript you could say something like, ‘Tell iTunes to set volume to 50 percent.’ So that reads as an English sentence, but it's also AppleScript code--it’s meant to be a usable language, but it fails because anything beyond one or two lines. The code just becomes so unreadable and so unnatural. It's almost like the Uncanny Valley of programming languages because it's almost English, but it's not.”

In God.js, however, that unnatural tone is intentional and conveniently appropriate. “That's what religious scripture reads like,” says Nasser. “So it takes a flaw of those attempted natural programming languages and actually uses it as a conceptually honest feature.” It's also oddly funny.

What God.js Actually Does

Almost every programming language supports embedded comments--lines of source code that the computer ignores. It’s a way for programmers to leave notes that explain what the code is supposed to do. For instance, any line of Javascript that begins with '//' is ignored and the rest of the text on the line serves as a comment.

In God.js, comments are replaced with your own “scripture code” which can be written in an embellished, dramatic vernacular. The compiler looks through the language to find only the things that are relevant to the execution of the code before executing them. “It was just really interesting designing that system where you could talk in this very dramatic language but it would still be parsable and understandable by the machines,” says Safrin.

Take the following snippet of Javascript:

View on GitHub

The first line is comment written in plain English and completely ignored by the machine. The second line is compilable Javascript, and the computer reads it and reacts to it by creating something called a function in memory and naming it "startGame." Comments allow you to mix human readable annotation with machine/human readable code to make a more coherent source text.

Javascript and most other languages require special syntax to demarcate what is and is not a comment (e.g. the // character sequence above). What's special about GodScript is that it makes no such requirement, and instead allows you to freely mix comment-code that does nothing with useful-code that does something. For example,


Two of the above five lines are "comments," ignored by the machine, but you couldn't easily tell by looking at the text. The way GodScript works is that it will try and parse a sentence in every meaningful way, and if it fails, it will just ignore that sentence and treat it as a comment. This allowed us to embellish our code freely and intermix over the top lines like "YOU WILL COME TO SEE THAT THIS WORLD IS PERFECT." and "THE PIOUS MAN WILL PRAY DAILY AND," with functioning code.

Of course, you'd never do this in a practical programming language, because it has the effect of turning all of your mistakes into comments, making debugging impossible. “It was done for GodScript because it served the aesthetic of the code,” says Nasser. “And a God laying down his or her sacred text is infallible, anyway, so typos aren't an issue.”

[Clouds Image: Flickr user wazimu0]