TL;DR my babbling about WebAssembly and the possible future implications

First of all, i’m not against WebAssembly, it is great that you can have an efficient bytecode that can run anywhere. But these are just my opinions/future visions.

Web is an great platform! I don’t mean the HTML or JS, they are terrible, but the ability to have everything in just one link away from anything else. That you can search for whatever information you want, that the web is open, that the web browsers are not just document viewers, but also application platforms. You can run the latest version of an application just by one mouse click! That’s convenient. You don’t have to download, install, configure and run it, you just click and it runs.

But, the web browsers purpose was originally meant to be, retrieving, presenting and traversing information resources on the World Wide Web. You have content, and want to present it. You have an declarative markup language and an rendering engine, that can draw the content as you would like.

You can draw rectangles with color, draw text with whatever font you like and draw images with the position and sizing as you would wish.

Than came javascript, and the browser would not anymore be just an document viewer. You could make dynamic changes to the DOM! But JS was never meant to be an language with which you can create an entire frontend framework, with templating, component building etc. It was designed for minor changes to the DOM. You clicked this, so JS sets some class there. And this event appends something to the DOM. And that event changes color of this thing. And that’s it.

How have we come to that the average website size is almost 3MB? Maybe it is it that HTML and CSS aren’t the best tools to build an document. Because they evolved from something that was not meant to be used the way it is used today. But that is just my opinion. (WWW sucks)

Here comes WebAssembly

The web is open, which is great! But the lack of choice in tools and languages you have isn’t great. You want to build an web app? Great! But you must use HTML/CSS/JS. Nothing else. This is the reason that there are so many languages that compile to js. But also that is madness. JS isn’t an language designed to be compiled to.

But don’t worry. Here comes WebAssembly to the rescue! WebAssembly is the new hope for the open web. You can now (or some time later) choose your favorite language to build the web! Isn’t it great? Yes, but …

WebAssembly can be compiled from C/C++. This brings enormous power (and responsibility), because you can theoretically build anything, that was written in C/C++ in the eons of their existence, and run it in the browser. When I found out that people are now running Qt in the browser, so now you can abandon HTML altogether and render your app just in Qt, it immediately popped up the similarity of an very interesting story about Wayland and X.

In it, Daniel Stone is explaining that X is very old (like HTML). And over the years it has gained many, many features (like HTML). And it’s original purpose was getting some commands, with an textual protocol, that will allow the user to render some rectangles, text and images (like HTML). But then this wasn’t enough. Users wanted rounded corners, and transparency and many other features that the textual protocol didn’t support. So they’ve build custom compositors, to do the job and then just tell X to render the buffer they’ve send. X has become bloated, it was an OS on its own, and in the end, no one wanted to use these features and X has become just an very bad IPC. And there the wayland’s story began …

Similarly, if people will start using GUI libraries, compiled to WebAssembly, they can abandon the old textual protocol (HTML), which was used to render things on screen, and render the page for them selves.

Full circle

And there you have it. Now you can download the Qt framework in WebAssembly, to run an application. Why on Earth would anyone download the Qt cross-platform application framework to run the application. This is why shared libraries where invented.

Maybe in the future, you will have some kind of modules that you can use to create your page. The modules will be cached by the browser, so the user don’t have to download it all the time. Like when you point to the jQuery or so. The web is an great platform and with this extension you can run anything without installing. The web is designed to be safe. From the beginning it was designed to be like looking on an document. You cant be harmed by looking on an document. Everything runs in it’s own sandbox an can do no harm to your computer (forget the java/flash plugins for a moment).

Anyway, the possibilities are much greater. In the future, you can compile any language to WebAssembly and run it in the browser. You can now run java natively in browser. The browser is becoming an OS on it’s own. An OS on top of an OS. The circle is complete! You have an OS, just to run your “browser OS”? Some people in Google thought about this a while ago and ChromeOS was born. But it isn’t an OS on it’s own. The Linux kernel is still under the hood. So it would be great to create an truly standalone “browser OS”.

And why stop there? If WebAssembly is apparently the ultimate portable “machine code” that everybody an agree on, why not create hardware with WebAssembly instructions? You don’t have to interpret the code, the hardware can already run it! IMHO it isn’t an crazy idea, python “hardware interpreter” already exists. So why not WebAssembly?

the end

So my babbling is over. I don’t know if anything of this is relevant or interesting to somebody, but I wanted to write down my thoughts and maybe get some objective opinions about it. That’s the way the web works, amarite?

WebAssembly is great and I can’t wait what the future will bring! :)