The Death of JavaScript

December 24, 2009

Jash Kenas released CoffeeScript today, a programming language that compiles to human-readable JavaScript.

It addresses a real need, exemplified by this image:

JavaScript was designed quickly and extended by dumb committees. It’s a messy language with a potent core. CoffeeScript aims give programmers the core without the mess. It’s nice. It’s broken in many of the same ways as JavaScript, because it’s just syntactic sugar on JavaScript, and JavaScript’s problems run deeper than syntax. But it can grow to fix these.

CoffeeScript and languages like it are the reason why JavaScript is going to die. Steve Yegge thinks JavaScript is the next big language, poised to take over the programming world. I disagree.

CoffeeScript is a baby in the growing family of languages that compile to JavaScript. These include Scheme, Hop, Java (via GWT), Smalltalk (via Clamato) and Objective-J. These languages are good. A programming language is a programmer’s main tool—and is thus the most rewarding place for improvement.

Imagine you can quantify the productivity of programmer using JavaScript. Over time, everything’s getting better: Libraries, JavaScript VMs, tools like Google Closure. JavaScript programmers are getting better at writing more better faster code as time goes on. Hurray!

There is another productivity curve. This is the curve of compiles-to-JavaScript language users. In this world, you can increase your productivity by using better languages.

Here’s the question: Does the compiles-to-JavaScript curve intersect the raw JavaScript curve anytime soon? If not, Steve Yegge is right. JavaScript wins as long as web browsers are the dominant application platform. But if it does… if it has happened already, even… then JavaScript as a human-use language will die, relegated to being a target language for compilers, like assembly code.

Here’s a brainstorm of some implications.

  • The ECMAScript committee should stop making up features to make JavaScript easier on programmers, and start changing features to make JavaScript more of a good target language.
  • The V8, SpiderMonkey, Carakan and other JavaScript implementations should start benchmarking on workloads that come out of code generators. (Actually, V8 already does this. They should do it more.)
  • The folks working on server-side JavaScript frameworks should just stop and go lie down, for the love of god.
  • Finally, future HTML standards should make allowances for JavaScript to be replaced. Something along the lines of <script language="CoffeeScript" compiler="coffee-script.js">code</script> could mean: Run code if this browser understands CoffeeScript natively. Otherwise, load coffee-script.js, find the compile function inside, call compile(code), and eval the result as JavaScript. I say this not as a proposal of how the forward-compatibility should work (I can think of at least one other way) but to make the point that we should be talking about it.

4 Responses to “The Death of JavaScript”

  1. Greg Wilson Says:

    1. Does CoffeeScript have a source debugger?

    2. Why make JavaScript a better target for compilers? Why not focus on standardizing the VM? I theorize that the JVM is responsible for the explosion of new programming languages in the last five years, not Java.

    3. Credit for the picture? 🙂

  2. Wes Says:

    Interesting perspective. But I think that JavaScript frameworks like jQuery combined with HTML5 are going to empower JavaScript as a core-to-the-web language.

  3. Redtexture Says:

    I regret to note that the prediction of the death of JavaScript, for the next five years to a decade is trending towards incorrect.
    JavaScript will not be die because of hundreds of millions of existing browsers providing and requiring Javascript–this makes JS the most popular language since VisualBasic, for better or worse.

    JS has become more effective though much-improved and competing browser (and non-browser) JavaScript runtime engines, such as V8, open-sourced by Google, or the efforts of both Mozilla and Microsoft.

  4. leptons Says:

    You are fooling yourself if you think coffeescript is going to replace javascript in any meaningful way. It’s really just a javascript compiler for people who prefer ruby/python syntax, and nothing more.

Comments are closed.

%d bloggers like this: