JavaScript has a lisp

It's been a while since Slashdot was my regular hang out - so perhaps the demographic has swung radically - but I was amused (and a little bit incredulous) to see a stack of mis-informed javascript hate in the comments of an article talking about Harmony (TC39), the proposed next version of ECMAScript.

In the last few years or so, JavaScript has come out of the closet and revealed itself as a powerful (though, like any good hero, slightly-flawed) functional language. Many people still haven't taken to it and choose to continue writing in an OOP style that they were told was good and enterprise-y. That's not a bad thing - that C/C#/Java coders can force JavaScript to behave mostly-but-not-exactly like their familiar ol' imperative friends is testament to it's flexibility: JavaScript can easily pretend to be imperative, because it can do anything.

So you can force JavaScript to have classical OOP inheritance (rather than the prototypical inheritance that is true to it's heart) and you can go on pretending you're coding Java and swearing when something doesn't work like your used to. And you can keep on swearing when you inherit a pile of spaghetti code written by the newbie who used to have your new job.

But heck, the fact that a designer somewhere can pick up enough JavaScript to actually achieve their goal is fantastic. The fact that most JavaScript code makes you want to cry is not so fantastic - but it's the natural consequence of having all but a tiny fraction of one percent of available JavaScript tutorials written by people who don't get JavaScript.

Perhaps what's needed it to really cast off the ugly baggage that's holding it back. Harmony proposes some great new features, and the less certain "Strawman" proposal puts shorter function syntax, and arrow function syntax on the table - but I think if we're really going achieve some real understanding we need to simply rename the entire language LispScript.

Once JavaScript gets prefix notation, the transformation will be complete.


  1. It’s so damn true!
    “The fact that most JavaScript code makes you want to cry is not so fantastic – but it’s the natural consequence of having all but a tiny fraction of one percent of available JavaScript tutorials written by people who don’t get JavaScript”

    I have been coding JavaScript for a very long time (in my perspective at least, almost two thirds of my life), but I have not really known JavaScript for more than a fraction of that time. And I’ve not coded too much JavaScript since I learned about AJAX and other cool stuff like the Canvas API, well I coded a top-down 3D thingie. But really, I’m not comfortable around JavaScript.

    And now I’m picking up node.js, and trying to learn that stuff. I find it quite hard to navigate around all this gigantic and expanding ecosystem, that has been around for less than ~3yrs or so. Looking at other technologies, I would have been considered an early adopter — but in the case of node.js I’m being waay behind everybody else.

    Quite fantastic, if you’re thinking about it.

    3½ day ago, I thought to myself, “Okay Frank, you’ve got 72hours — And you’re going to make an (non-massively) online multilayer role-playing adventure space shooting real-time strategy game; Or something like that”.

    And guess what, I failed. Not because the task is greater than what I can handle, not at all. I downloaded a REAL starchart that I was going to use for the space-exploring thing. It included the velocity vectors for the stars, so I was planning on having a black hole somewhere that would take you some million years into either the future or the past, I could not decide which…

    But it did not really matter that I by some freaky mind-flash got an quite good Idea of how the game was to be, and how stuff where supposed to be implemented — I failed, big time.

    And the reason is that I choose to use node.js, hell there is free servers! My own rented space ain’t going to host any fancy games, the only thing available is PHP, and anything that can get compiled down to PHP (haXe).

    And I’m quite confortable with the syntax of coffe-script (Which I discovered by accident, by visiting createyourproglang .tld). It has arrow functions like, square = (num) -> num*num

    Oh, gosh! Now I got caught up doing something other than what I’ve planned — again ;)

    “Frank, reinstall your damn laptop and continue work — like NOW!” (Kicking my own ass)

    But first, a good ol’ cup o’ tea ;)

    Saturday, October 29, 2011 at 8:36 am | Permalink
  2. I forgot to say in my last comment that it is not in the fault of node.js that I failed!

    The reason I failed where because I could not get an good environment up and running, I also spent ~8h or so trying to get it working on the “production” server (→ quite blank right now).

    But after I noticed that I had misunderstood how a few functions in node.js´s API actually worked and manually installed the dependencies of the dependencies of my project (subdependencies, if you want) — I got that to work.

    Then I tried to ditch my own homebrew framework and start to use express.js — then I failed big time!

    I should have stuck to my own weird solution, but lessons learned — I’ll do my own framework that integrates with qq, docco, NowJS and whatever else good I can find.

    I’ve still now found a good database for node.js, I was instead thinking on relying that node.js can keep it all in memory until I do find a good DB — and also having it send the gamestate off-site maybe once an hour or day.

    Mandatory break when the clock says “(e)leet” x-D, maybe? *hehe*

    Saturday, October 29, 2011 at 8:49 am | Permalink

Post a Comment

Captcha! Please type 'radical' here: *
How did you find this thingo? *