JavaScript and Christology


From my time teaching at Devbootcamp one of my “famous” lectures was the “JavaScript is like Jesus” lecture. This is a simplification, and I would have called the lecture “What Aristotle and the Arian Heresy teach us about thinking about JavaScript,” but terseness was never my strong suit (you are reading my blog after all).

Nevertheless, if one of these simplifications managed to help my flock remember and appreciate some of the subtleties of JavaScript, then all the better. I’ll now share the “JavaScript is like Jesus” content.

Content Warning: this post is written without a religious point of view. It considers Christianity as a historical phenomenon (what happened historically) and Christian dogma as philosophy. If your beliefs forbid consideration of this faith from such a perspective, you might want to skip this post.

Let’s start with a simple demonstration:

> f = function() {}
< () {}
> o = {}
< Object {}
> Object.getPrototypeOf(x)
< () {}
> Object.getPrototypeOf(o)
< Object {}

Here we define f and o and then ask the Chrome V8 JavaScript engine to tell us what it considers f and o to be. Helpfully enough, Chrome tells us that f is a Function and o is an Object.

From a certain perspective, and certainly in common programing pedagogy, we learn that Functions are things-that-do-work and Objects are things that hold data like 1 or 3.14 or "Manhattan". Functions change data, but data is not runnable.

Consider this JavaScript expression: x.color = "Red";

“Is x an Object or a Function? What is the essential nature of x?”

The battle of wits has begun! More after the jump.

We intuitively believe that the answer should be singular and if it were plural the world would be rather confusing. “Things don’t have multiple essences,” our Aristotle-influenced sense of the world screams at us across millennia.

It’s at this point that I like to take a historical dog-leg and share a bit of philosophical / theological history. When we approach things in the world we tend to look for their essential (from Latin esse: to be) nature. Throughout classical philosophy this is known as the substance (from Latin sub-stare under which it stands, foundation) of the thing.

Some aspects of the things are considered to be modifications of the substance. That is, while they may vary, they do not constitute a change in substance. So both Pierre and I are “Man” with respect to substance but the accident of my brown hair or of his baldness does not invalidate us being identified as “Men.” It bears saying clearly here: things have one and only one substance.

This metaphysics was laid out by Aristotle in Categories and its rich vestiges can be felt throughout history. When Catholics experience trans-substantiation upon eating the bread and the wine they are experiencing a theological dogma whose metaphysics are grounded in the substance / accident metaphysics. Through miraculous transubstantiation, in the mouth, in ore, these quotidian comestibles become the very Body and Blood (different substances).

Now that we’ve aligned our recollection of Aristotelian metaphysics, let’s ask ourselves a very difficult question. What is the substance category of Jesus Christ? Trying to sort this out was a great source of debate in the Greco-Roman Near East in the early parts of this era. Here is a sampling of questions with unclear answers in terms of Christology and Aristotle’s metaphysics.

  1. Since He evaded death, He is clearly not mortal, ergo he is not Man
  2. Since He was incarnate and borne of woman, He is clearly Man
  3. Since a mortal vessel (Woman) without Divine essence (Mariah) bore Him, and He bears Divine essence, she must, in essence have possessed the Divine as well.
  4. But if Mariah had Divine essence to give, how did she get it? Was she also Divine, too? But that begets an infinite regress because for her to have it, her parents must have had it and so on all the way back to God Himself…which presumably means there’s a whole bloodline we should be venerating
  5. OR the force that impregnated her must have brought all the Divine and she was “merely” the vessel for His divinity (theotokos)
  6. If He was born, then there was a time he Was-Not, that implies that he might have been Divine, but not like God Himself. Perhaps he’s a lesser form of Divine?

It’s a series of paradoxes and contradictions that would make Vezzini’s head spin.

These questions set up some of the core heresies underlying the Early Church. It lead to all sorts of amusing excommunications and denunications between the bishops of the early centers of Christianity like Rome, Alexandria, and Constantinople.

Logically-minded people steeped in the same philosophy, a great many of them priests themselves, saw that clearly 1 and 2 are at odds. Similarly point 3’s infinite regress leads immediately to a reductio ad absurdum. Point 4 and 5 are at odds (and are at the heart of some of the tensions behind the Great Schism wherein Catholicism divorced itself from the Greek Orthodox church).

For many people these internal inconsistencies either occasioned atheism, polite dismissal of Christianity (“surely something that’s of God doesn’t have so many inherent contradictions in its dogma, no?"), or something more exotic.

One of those “more exotic” paths was proposed by Arius and is now named The Arian Heresy. Arius held that God the Father, by means of the Holy Spirit, in-carne-ated (literally the Latin word for in-meat-ified), His substance in to a human. Therefore a mortal woman could birth a God-the-Son, a being of one substance (consubstantialis) to God-the-Father provided the impregnator was itself Divine. There was a time when the Son was not, but God-the-Father made him of his own substance, incarnated.

Speaking as a programmer, this is a very elegant solution. HOWEVER it runs against a constraint. If Christ was God, then He did not suffer on the cross How could He suffer if, at the time He was suffering, He was still of the God-substance: omnipresent, perfect, omnipowerful? He knew it was part of His plan. If that’s the case, then the act on Golgotha is just a bit of performance. That simply wouldn’t do for the elders and lead to untenable doctrines like “The Fortunate Fall".

OK, so, speaking as a programmer, new constraint. God has to be Man substance as well. Metaphysics says that things only have one substance. Here’s where things get sticky. Here are the logical options:

  1. Physics is wrong some things have two (three, n-many?) substances
  2. Physics is right: all things have one essence, but some thing is exceptional (i.e. a “hack”)
  3. Intellectual nonsapience: “It’s divine, we’ll never understand it with logic!”

While many modern Christians take the last path, the Church elders didn’t have the numbers on their side and knew they had to resolve the inconsistency. Therefore option number 3 was not available to them. Also, they recognized that their audience was not going to take it as a good sign that a 1,000+ year plus tradition of Aristotelian metaphysics would have to be cast into doubt in order to accept their dogma, so option 1 was not likely to carry the day. That left option 2 and that’s what Christianity religious construction on.

Thus speaking as a programmer, the Church fathers went with #2, a glorious hack, a one-time exception. The solution is as effective as it is minimalistic and naive. Jesus Christ was a God-Man: a being of two substances. Eventually this hack had other aspects bolted on (see the Holy Spirit and the Trinitarian doctrine) and became a, from a programmer’s perspective, a special-use class. Eventually this irregularity was wallpapered over and enshrined in the [Nicean Creed][] which holds:

We believe in one God, the Father Almighty, Maker of all things visible and invisible.

And in one Lord Jesus Christ, the Son of God, begotten of the Father [the only-begotten; that is, of the essence of the Father, God of God,] Light of Light, very God of very God, begotten, not made, being of one substance with the Father;

Here we see the contradiction resolved by raw credo: One God, an Almighty Father, and his Son, a literal clone, but of separate identity, eternal and consubstantialis to the Father.

And thus, back to JavaScript in which a Function is of two substances: it is both a Function, an executable thing but for that it is no less an Object.

Thus is answer my original question is “We have no way of knowing, from the outside whether x is a Function or an Object.” One could only resolve the question by assessing x's behavior (that is, it is call()-able).

< undefined
< Uncaught TypeError: is not a function

Similarly, from exterior appearances the dwellers of the ancient world would not have been able to know whether the Semitic biped standing before them was merely a Man or a God-Man but for His behaviors (can return the dead to life, can perform substantiation of matter, etc.).