Will JavaScript die due to WebAssembly?

We are so much into JavaScript today!

JavaScript is no more a toy language. It’s there from the client to servers; from local machines to database. Some are also trying to code embedded in JS… we’re so much into JavaScript today.

The noise of JavaScript is being heard by the non-JavaScript developers too. People from different backgrounds are on boarding into JavaScript… because, we’re so much into JavaScript today.

Companies are rewriting products in Node; some are trying to make rich UI; few will start up only with JavaScript… we’re so much into JavaScript today.

No, it’s not Java any more… the most used/talked language in github or stackoverflow is not Java or Python. It’s JavaScript… we’re so much into JavaScript today.

Seriously… we’re so much into JavaScript today.

Now, when the market is a little tilled towards the language and most of the programming jobs in job portals want JavaScript skills; lot of developers have started learning this language. And people who were already in that field, has certainly got an advantage. But will this golden era of JavaScript continue? Will it never die?

Web is hot. We all are in the web. People don’t like natives things much. They want everything in the web. Online.

I think this is the first but biggest reason why JavaScript is so popular. After flash being killed by Apple, JavaScript remained the only option to make handsome applications in the web front-end. And with the help of jQuery and the war of MVC frameworks, JavaScript really grew super fast.

When Ryan Dahl successfully ran JavaScript in his run-time called Node.js, the world went crazy. A language which was limited to client side was started being used in server side and eventually as task runners too. This is reason number two.

These two points helped creating the third reason, which is npm. Currently npm is the largest package manager on earth. pip, gem etc are no where close and npm is still becoming fat day by day.

With TC39’s (the committee which controls ECMA) per year spec release decision, ECMA script will evolve more and hence JavaScript too and we really can’t see it stopping in near future.

What is WebAssembly (wasm)

The creator of JavaScript, Brendan Eich planted a seed called WASM or WebAssembly two years back, which is growing fast today. The seed of supporting assembly language in browsers, natively.

The browsers supports only JavaScript because introducing too many VM inside a browser instance gives multiple issues. That’s the reason why the attempt to introduce JVM is also failed. There are many tools or language today where you can write web programming; but at the time of compiling, they transpile them to JavaScript. Thus lot of features become fake, as JavaScript doesn’t provide you very low level apis.

Eich’s idea was to provide an intermediate compile target which will give us access to a handy amount of low level building blocks using which we can create almost anything. That anything will be way beyond the capability of today’s JavaScript.

web-assembly-other-lang

Is web assembly a new language?

Ah.. not really. It’s more similar to machine language. Though you can code on it; but you won’t. Cause you know english language, not machine language.
But, this may give birth new languages in the market which you will be able to use as an alternative to JavaScript.

How different is it from JavaScript?

Very much. It’s certainly a very low level language which will provide better ways to communicate with the hardwares. It won’t even provide an automatic garbage collector.

Is wasm actively evolving?

Yes. There’s an active group of folks from Mozilla, Google, Apple, TC39 and many more. You can find them in github.
You can use browsers like Chrome Canary (which is chrome only with experimental features available) to run your WebAssembly code.

Any way to use in normal browsers?

Yes! asm.js (a JavaScript subset) may help you with this. You can check the working demo by WebAssembly org.

How wasm is a threat to JS?

As I said, one of the major reasons why JavaScript is so popular today is because in web-client, you can only run JavaScript.

But with the rise of WebAssembly, you will soon find new languages coming into the market. Event the other popular languages like C#, Java, Python will also start supporting web programming, cause they will compile everything to wasm.

So it will increase competition in the market. Obviously competition is good and this will help evolving the web more, but people from different language background may stop getting into JavaScript. After-all, JS doesn’t provide you those many things (JS of today) how much giants like C# or Java provides.

How wasm will benefit JavaScript

You might be wondering, bit while ago I was saying how wasm can low down the value of JavaScript, but now I’m saying how it can benefit JavaScript.
Trust me, I’m a JavaScript lover and I’m really excited and happy about wasm. And if you too are a lover of the language and not the market; you will also be happy.
The problem with JavaScript is, it still doesn’t provide you much things. Even the basic things. You can’t even create stack & queue in JS. All you can do is implementing it in a ugly way using array which is too slow.
With WebAssembly, the scope will grow. There are chances of getting more low level apis and better programming techniques in JavaScript.
In the future with WebAssembly JavaScript may implement the followings.

  • Multi thread
  • VR & Augmented reality
  • Better graphics
  • Playing with memory blocks
  • Native compilation support

However all those points are just possibilities, but not included in ECMA specs yet. But certainly those are not just imaginations too.

Conclusion

I can’t say if JavaScript will die soon or not; but I can strongly say wasm is a friend to our beloved JavaScript and will only help empowering it. JavaScript as a language will evolve more and lot of things which we do in a hack way in JavaScript will completely vanish.
I accept, if more languages evolve, the market share of JavaScript may go down due to competition. But we must not forget how much competition Node.js faced in the server side web. But it not only survived, but performed so well that people have started switching their server side to node.
Competition is the root cause of evolution and thus, irrespective of what happens to JavaScript, we can say, the web is going to be better for sure. And that is why, even if JS dies due to the new languages by WebAssembly, we shouldn’t hate it, just because… we’re so much into JavaScript today.

About This Author

Hello! I am Paul Shan, a JavaScript Expert, Full Stack and DevOps Engineer cum Consultant based out of Bengaluru, India.