Thursday, November 10, 2011

Is JavaScript a Lisp in disguise?

It is something of a commonplace to say that HorrorJavaScript is a Lisp or Scheme in disguise.

But that's completely wrong!

Yeah, JavaScript gets closures right, and that has become the yardstick for measuring amateur-designed languages. If you do closures right, your language immediately enters the upper echelons of the language space. Sad, but true.

But in every other respect, JavaScript completely fails the Kool-Aid Lisp Test.

Rich arithmetic: NO
Multiple values: NO
Macros: NO
Closures: YES
Complex Lambda lists (optional, keyword, rest parameters): NO
Conditions, restarts: NO
Generic functions: MAYBE (through JS's hare-brained "object system")
Programmable parser: NO

But most of all:
JavaScript offers a maximum of nonsense, as amply documented. If you use Perl, you have 2 problems. If you use JavaScript, you have NaN problems.

If you say that JavaScript is a Lisp, you don't know jack about Lisp.


Craig said...

I've been ruminating on benevolent dictator vs democratic languages as we seem to leave language design to the dictators rather than designing them to evolve and be extended (composed) organically and with fine-granularity. This is why I love code <==> data compositional languages, especially concatenative languages and papers like Ian Piumarta's that highlight the importance of making the fundamentals of language itself flexible enough to extend for any particular context.
Even grand 'data' protocols like Van's CCN lock us into 'data' dictatorships.
The ALU/Memory aka JS/HTML aka code data divide dictatorship is a pet hate of mine.
I'm currently of the opinion that popular language design and education is the result of the lowest common denominator; the platform (popular hardware and software and minds that perpetuate the separation of the two). It's my belief that if you make that platform genuinely reconfigurable then you get composition at scale. The same logic applies to Maciej's pinboard rant about the Social Graph and standards.
Until individuals can compose as they or the automated bots augmenting their lives see fit, as well as aggregate and feed those compositions back to the individuals in order to reevaluate and reconfigure - then individual feedback will be largely ignored and the world will become an even lonelier place. Instead, slow acting dictatorships (or standards bodies) come to favour to spoon-feed and suppress the masses, and that's been happening all over the world because it's in peoples nature to abstract the world away and let someone else handle the problem... just like Lambda abstraction has been doing. =)

When it comes to language comparisons, some users think their languages can do everything other languages can simply because they fail to see the abstraction compromises. In Only Forward - one of my favourite books - there's a neighbourhood known as The Centre that's filled with Actioneers with a can-do attitude hooked on a can-do drug harvested from humans. I see parallels to the Actioneers with our own world but instead see most people more like Abstractioneers that are currently at war with the Actioneers of the world in order to remove those compromises (drug harvesting). Something that will only increase the more the world is abstracted away; something very easy to do unsustainably with population growth when you can get lost in a crowd, or the system. And when people get lost they bleet and spontaneously combust like the sheep in the awful book that is Before & After. =)

Manuel Simoni said...

Thanks for your interesting comment.

SamB said...

I thought JavaScript was a bring/build-your-own-object-system kind of language …