Introducing Crossbow.js — The world’s first Arrow-Oriented Programming Language.
It’s a language. The “.js” is only for marketing purposes.
The Arrow Axioms.
Arrow-oriented programming consists of a new primitive, the arrow.
Here are the core principles:
- Everything is an arrow.
- An arrow can point to another arrow.
- An arrow can be “shot,” which causes its head and tail to be evaluated into the tail of the arrow it was pointing into.
- For a program to be valid, there should be exactly one arrow that has no arrow pointing to it.
- The program continues until all arrows stop moving.
Hello, arrow.
If you think that this is confusing, don’t worry. It is. But it’s also incredibly powerful. For example let’s look at a simple function:
add(x, y) => x + y;
This function takes two arguments, `x` and `y`, and returns the sum of `x` and `y`. In Crossbow.js, this function would be written as:
add(x, y) => x + y;
The `=>` is the arrow operator, and it is read as “shoots.” So the function `add` returns the sum of `x` and `y`. As you can see, the arrow operator allows us to write functions in a very concise way.
Now you’re thinking in arrows.
The Zen of Arrow-Oriented Programming.
The axioms allows for the existence of two peculiar arrows: the arrow that points to itself, and the arrow that points to nothing at all. Respectively, we call them the God arrow (also known as Ouroboros, in reference to the mythical dragon that eats its own tail), and the null arrow. Out of them, we can construct Boolean logic, but with the added benefit that everything is an arrow, so that pointers are for free.
In the future, quantum computing could enable arrows that point to two different targets at the same time. The consequences of this are obscure, but do consider investing.
The making of Crossbow.js
What follows is a debate between professor Hernandez of the National Polytechnic Institute, creator of Crossbow.js, and tech evangelist DJ Null.
Hernandez: First of all, let’s not forget the topology of a computer. Old computers were huge cubes, that is, three-dimensional. A laptop is actually shaped like a book; if you open a book, it is mostly a plain surface, that is, two-dimensional. By extrapolating this, we can predict that future computers will be one-dimensional. That is, a line.
Now, a line has three parts. The bottom of the line, the top of the line, and the shaft of the line. This is optimal, as I will demonstrate.
DJ Null: I know what you’re gonna say, amigo. It’s easy to extrapolate a list of errors in your line of thinking. In any case, I would rather give our readers the short version of your argument: Of all the shapes, you think that the arrow is the best, or at least the least bad of them. None of this matters in the real world.
For example, how do you like your coffee? I like my coffee black with a bit of sugar. Now, imagine how long it would take to write down the list of all possible ways in which a reasonable person might enjoy coffee. If you use arrow-oriented programming, the list might end up like this:
I like my coffee with a little bit of milk.
I like my coffee with a lot of milk.
I like my coffee with a little bit of sugar.
I like my coffee with a lot of sugar.
I like my coffee with a little bit of cream.
I like my coffee with a lot of cream.
I like my coffee with a little bit of flavor.
I like my coffee with a lot of flavor.
I like my coffee iced.
I like my coffee hot.
I like my coffee cold.
I like my coffee with a little bit of ice.
I like my coffee with a lot of ice.
I like my coffee with a little bit of foam.
I like my coffee with a lot of foam.
I like my coffee with a little bit of whipped cream.
I like my coffee with a lot of whipped cream.
I like my coffee with a little bit of chocolate.
I like my coffee with a lot of chocolate.
I like my coffee with a little bit of cinnamon.
I like my coffee with a lot of cinnamon.
I like my coffee with a little bit of nutmeg.
I like my coffee with a lot of nutmeg.
I like my coffee with a little bit of vanilla.
I like my coffee with a lot of vanilla.
I like my coffee with a little bit of caramel.
I like my coffee with a lot of caramel.
I like my coffee with a little bit of hazelnut.
I like my coffee with a lot of hazelnut.
I like my coffee with a little bit of almond.
I like my coffee with a lot of almond.
I like my coffee with a little bit of peppermint.
I like my coffee with a lot of peppermint.
I like my coffee with a little bit of mocha.
I like my coffee with a lot of mocha.
I like my coffee with a little bit of espresso.
I like my coffee with a lot of espresso.
I like my coffee with a little bit of decaf.
I like my coffee with a lot of decaf.
I like my coffee with a little bit of soy milk.
I like my coffee with a lot of soy milk.
I like my coffee with a little bit of rice milk.
I like my coffee with a lot of rice milk.
I like my coffee with a little bit of skim milk.
I like my coffee with a lot of skim milk.
I like my coffee with a little bit of 2% milk.
I like my coffee with a lot of 2% milk.
I like my coffee with a little bit of whole milk.
I like my coffee with a lot of whole milk.
I like my coffee with a little bit of skimmed milk.
I like my coffee with a lot of skimmed milk.
I like my coffee with a little bit of nonfat milk.
I like my coffee with a lot of nonfat milk.
I like my coffee with a little bit of almond milk.
I like my coffee with a lot of almond milk.
I like my coffee with a little bit of oat milk.
I like my coffee with a lot of oat milk.
I like my coffee with a little bit of cashew milk.
I like my coffee with a lot of cashew milk.
I like my coffee with a little bit of macadamia milk.
I like my coffee with a lot of macadamia milk.
I like my coffee with a little bit of hazelnut milk.
I like my coffee with a lot of hazelnut milk.
I like my coffee with a little bit of coconut milk.
I like my coffee with a lot of coconut milk.
=> Execution stopped. Please insert more arrows.
Want to Connect?Thanks for reading! If you enjoy humorous tech stories like these and want to support me to keep writing forever, consider signing up to become a Medium member. It’s $5 a month, giving you unlimited access to stories on Medium. If you sign up using my link, I’ll earn a small commission. You can also follow me on Twitter.