Linked by Thom Holwerda on Mon 1st Oct 2012 22:55 UTC
General Development "Everyone seems to have a replacement for JavaScript - Google even has two. Now Microsoft has revealed that Anders Hejlsberg has been working on a replacement and it has released a preview of TypeScript. TypeScript is open source - Apache 2.0 license - and a superset of JavaScript. As you would expect from a Hejlsberg language it incorporates type checking, interfaces and lots of syntactic sugar."
Permalink for comment 537297
To read all comments associated with this story, please click here.
Lots of work; little gain
by spudley99 on Tue 2nd Oct 2012 09:20 UTC
spudley99
Member since:
2009-03-25

Heh. Here we go again.

Someone else has said to themselves "Javascript is cool, but it's also rubbish. Lets make it better."

It's a fine sentiment, and clearly popular, if Dart, Typescript, Ecmascript6 and particularly Coffeescript are anything to go by.

But in the end, what is the point?

Javascript is popular for one reason alone: it runs in the browser, and it runs the same(ish) in all browsers.

Without that fact, Javascript has zero reason to continue existing.

But the problem for all these initiatives to improve it, is that this same fact also ties us down to sticking with Javascript. It's the "lowest common denominator" problem -- we have to write code that works in all browsers, so we have to write Javascript. And we can't even use the latest features of the language because we need to support older browsers.

And then there's this bizarre notion of running JS code on the server. Node.js. WTF?? Why on earth would you take the most poorly designed language you can find and cram it into a whole new environment?

Two answers: (1) because all the work in the browser end lately has left us with insanely fast Javascript interpreters, which screams past every other scripting language you can think of, and (2) because developers want to write code in the same language for the client and server.

Again, it's not the quality of the language that's driving Javascript's adoption, it's the browser. It's all about the browser.

The thing is, the more people get drawn into Javascript, and the more universal it becomes, the more it's flaws become apparent. People get an itch to fix them, and you get Coffeescript. Or Dart. Or Typescript.

But none of them solve the actual problem, which is that we actually still have to work with Javascript.

So how do we solve this actual problem? Well it seems that the only real solution is progressive enhancement. The Ecmascript 6 approach. Improve the language one step at a time; browsers implement the new features; users upgrade their browsers, and slowly over a period of time we end up with a better language.

Typescript, Dart and even Coffeescript are doomed to failure because they aren't part of this process. The main reason they keep trying anyway is impatience. "Why wait three years for everyone to upgrade their browsers when we want new shiny stuff *now*?"

The one place where these languages might have a chance is on the server, where they could replace the insanity that is Node.js.

But even here, the question is: what's the point? Why create a language based on Javascript at all? We all know it's not a good language, so why start with it in the first place?

What you really need for this is not to enslave yourself to improving JS, but create a language that starts on a fresh footing, maybe draws from JS, but also from elsewhere, and most importantly doesn't make the mistakes made in JS. But equally important (it seems, given Node's success) is to have a blisteringly fast script interpreter.

Oh, and getting buy-in from the developer community would help too. Get it standardised and ratified. Collaborate with the industry rather than going it alone -- Google, Microsoft, everyone else: Talk to each other. Create something together. Dart has languished because Google is too much in control of it. Maybe we have learnt something from Java after all. Coffeescript has done fairly well because it's not controlled by a big corp. That still doesn't make Coffeescript a good idea, but we need to learn from its success.

Sorry. I'll stop ranting now. I'm willing to bet no-one will agree with a word I've said, but never mind.

Reply Score: 3