• Download Gist
antique_programming_language_road_show.mkd
Markdown

Antique Programming Language Road Show

XKCD comic about Lisp

Let's talk about a language we all probably know: Javascript. It was created in the 90s by Brendan Eich. It's everywhere on the web. It's over 15 years old, which is a lifetime in Internet years. It's got these three features.

Where did it come from? Before it was created, another language was being embedded in web pages -- Cmm or C-minus-minus, or Cenvi. These were "Expresso Pages." Cmm -- C-without-the-hard-stuff -- looked like C, as did Java, another hot language at the time that JavaScript took its name from. So we get C-like syntax.

Cmm is derived from C, of course. What's interesting about C? Well, it's everywhere. C's ubiquitous, and even if you never write any of it, you use it. It's the lingua franca of programming. Part of the reason why is that it was written to be cross-platform. It's got a standard library, and so a C program written against that library should compile on multiple computers. Emphasis on should.

Ok, back to JavaScript. What's a prototype-based object? Well, JS has objects unlike what we see in Ruby or Java or Python or what have you. They don't have a class -- like they don't have a job title. Instead, each object is unique, but can have a prototype, or another object it can call back to if it doesn't know how to handle a message. Like my dad is a farmer, but I am not of the Farmer class. I'm unique, but you can ask me how to farm, and I will call him, right.

Ok, where'd this come from? Well, there was an experimental language called Self at the time. Been around since the late 80s. We're 25 years in the past at this point. This language is the progenitor of prototype-based objects. What's interesting about it? Well, besides introducing prototype-based programming, it uses this idea of an image - a virtual machine that writes out to disk, so it maintains its state. This lets you debug and hot-swap code - "on the fly" development. It's a little unwieldy to use, but has its advantages.

And that feature comes from an earlier language, Smalltalk. Here's an influential language. One of the first object-oriented languages. Everything's an object - even classes, so you can manipulate them like any other object. It's got message passing, which is how objects tell other objects what to do, but it's also special in Smalltalk. It's not just calling a function: each object takes its messages and decides how to process them. And Smalltalk came with a complete integrated development environment, one so integrated with the language that modern IDEs still don't touch it.

We don't use Smalltalk a lot today, but it birthed one of the biggest languages around, Java. Java's a lot less ambitious than Smalltalk in my opinion, but it's done well. Almost everything's an object - although there's no meta-classes. It's got a virtual machine, and that's important. It's not an image like Smalltalk's, so it's easier to use. You could write other languages that run on it, plus you can write the same VM for different platforms, so it's really cross-platform.

And so Java's other parent is C. It's got similar syntax, and it aims to be even more cross-platform.

Ok, back to Smalltalk. Its ideas are in a lot of languages.

Here's Erlang. Erlang took message passing and did something great with it. Messages can be passed between objects, even ones running remotely. And objects don't have to immediately reply. So this can be used for concurrent applications. Erlang can control many objects on multiple machines, all passing messages and responding when they feel like it. These are sometimes called actors. They act independently.

And that brings us to Scala, which takes its actors from Erlang. But look! It's on the Java Virtual Machine.

It's one of those languages we talked about that could run on there. So Java is a parent of it, too. Cool.

Back to Smalltalk.

Look what else it inspired: Ruby, one of my favorite languages. Everything's an object and it's got meta-classes. Every object can be manipulated at runtime. You can do some really cool, really spooky stuff. But what else is cool about Ruby. What's a first-class function? (Or higher-order function, you might call it.)

JavaScript has these too. Where'd we get them?

LISP. Here's a really old language, over 50 years old. So, a first-class function means that a function can be used and manipulated in the system like any object in the system. A higher-order function means a function that can take functions and return functions. This sounds complicated, but it's incredibly useful and makes programming in modern-day JavaScript quite nice. LISP has something else really cool though: code as data. LISP is homoiconic, to use another word. Every piece of code in LISP can be manipulated by LISP as if it were data, because it is. Everything in the system uses the same structures. This lets you do some even spookier stuff. You can take any code and re-write it on the fly using macros to generate much more complex code. You can basically write your own new subset of the language, making hard stuff super-simple using your new language.

These first-class functions are in Ruby, like we said.

And in a bunch of other languages.

The hottest one right now is Clojure. Clojure looks like Lisp. It's a modern version of Lisp. It's got code as data, which is super-powerful. It's got first-class functions. And look! It runs on the Java Virtual Machine. Now we're back to Java. This doesn't just mean that it can use the same virtual machine to execute Clojure code. Nope - code in any language that runs on the Java Virtual Machine can be called from Clojure.

And from Java. And from Scala. That's amazing. That opens up libraries from all sorts of other languages.

So you can see how these languages are connected. C and Smalltalk beget Java. Java and Erlang beget Scala.

LISP begets everything, with some help from Smalltalk and C.

And look what we haven't mentioned. The point is that these older languages have features that made the features we have today. Some of them have features we still haven't replicated. Mining these languages is where we get ideas for new and amazing languages to help us in the future.

And that's my talk.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.