Is WebAssembly the Return of Java Applets and Flash?(words.steveklabnik.com)
words.steveklabnik.com
Is WebAssembly the Return of Java Applets and Flash?
https://words.steveklabnik.com/is-webassembly-the-return-of-java-applets-flash
399 comments
> If you built an applet in one of these technologies, you didn’t really build a web application. You had a web page with a chunk cut out of it, and your applet worked within that frame. You lost all of the benefits of other web technologies; you lost HTML, you lost CSS, you lost the accessibility built into the web.
But that's also true of an application which relies on WebAssembly (or JavaScript): it loses all the benefits of the web, because in a very real sense it's no longer a web site, but is instead a program running in a web page.
WebAssembly or JavaScript, neither is document-oriented; neither is linkable; neither is cacheable. It's Flash, all over again — except at least with Flash one could disable it and sites were okay. with WebAssembly & JavaScript, every site uses them for everything, meaning we get to choose between allowing a site to execute code on our CPUs, or seeing naught but a 'This page requires JavaScript' notice.
It is the return of Flash, and that's a bad thing. We thought we'd won the war, but really we just won a battle.
But that's also true of an application which relies on WebAssembly (or JavaScript): it loses all the benefits of the web, because in a very real sense it's no longer a web site, but is instead a program running in a web page.
WebAssembly or JavaScript, neither is document-oriented; neither is linkable; neither is cacheable. It's Flash, all over again — except at least with Flash one could disable it and sites were okay. with WebAssembly & JavaScript, every site uses them for everything, meaning we get to choose between allowing a site to execute code on our CPUs, or seeing naught but a 'This page requires JavaScript' notice.
It is the return of Flash, and that's a bad thing. We thought we'd won the war, but really we just won a battle.
The OP is really spot on.
For the commenters that seem to have some underlying fear that WASM apps will be another incarnation of a "window in a window" or some horrible bitmapped graphics pane that does not fit into the web model:
WASM is just a CPU. It's a bytecode format for expressing low-level, high-performance programs. It comes "batteries not included"--intentionally. By batteries, I mean APIs. WebAssembly modules must import everything they need from the outside. When embedded in JS and the Web, the first and still primary use case of WASM, that means modules can import functionality from both JS and the Web, and call literally anything that JS can call. That means WASM can (though still somewhat clunkily) manipulate the DOM, WebGL, audio, service events, etc, through all of the same APIs that JS can do. There is nothing that prevents a WASM app from looking and feeling exactly like something written in JS.
To reiterate: WASM does not require you to drop down to canvas or render fonts yourself. You can call out to JS or direct to WebAPIs! (again, it just happens to be clunky to do this from C++.) But other languages are working on bindings that make this much nicer. Rust anyone? :)
What WASM gives the web is a proper layer for expressing computation. The APIs and paradigms that build on top of WASM are independent, swappable, interposable, by design. Because it's a layer for computation, and a low-level one, it is by nature language-independent. As Steve mentioned, adding languages to the web one by one does not scale. Thus WASM.
For the commenters that seem to have some underlying fear that WASM apps will be another incarnation of a "window in a window" or some horrible bitmapped graphics pane that does not fit into the web model:
WASM is just a CPU. It's a bytecode format for expressing low-level, high-performance programs. It comes "batteries not included"--intentionally. By batteries, I mean APIs. WebAssembly modules must import everything they need from the outside. When embedded in JS and the Web, the first and still primary use case of WASM, that means modules can import functionality from both JS and the Web, and call literally anything that JS can call. That means WASM can (though still somewhat clunkily) manipulate the DOM, WebGL, audio, service events, etc, through all of the same APIs that JS can do. There is nothing that prevents a WASM app from looking and feeling exactly like something written in JS.
To reiterate: WASM does not require you to drop down to canvas or render fonts yourself. You can call out to JS or direct to WebAPIs! (again, it just happens to be clunky to do this from C++.) But other languages are working on bindings that make this much nicer. Rust anyone? :)
What WASM gives the web is a proper layer for expressing computation. The APIs and paradigms that build on top of WASM are independent, swappable, interposable, by design. Because it's a layer for computation, and a low-level one, it is by nature language-independent. As Steve mentioned, adding languages to the web one by one does not scale. Thus WASM.
I'm typically sharply critical of the web, but I think this comparison is kind of silly. The biggest problem with Java Applets and Flash is the security issues, which were largely caused by giving web pages access to a second, less secure sandbox. WASM stays in the same sandbox as the rest of the web. Flash also had the problem of being proprietary and non-standardized with only one implementation, something WASM does not suffer from.
For those worried about the "all WASM" pages looking like the old "all Flash" pages of yore, consider that Flash and Java applets had their own UI stack and WASM does not. The closest WASM has to that is OpenGL, but you've been able to make all-OpenGL apps with pure JavaScript for some time and it hasn't taken over the web with terrible sites yet. WASM code can interact with the DOM. I guess we could worry about native C/C++ GUI toolkits being ported to WASM, but the web community gets what you deserve for making Electron a thing.
I don't like JavaScript in general but I don't see how WASM is any worse, and if anything it's quite a bit better.
For those worried about the "all WASM" pages looking like the old "all Flash" pages of yore, consider that Flash and Java applets had their own UI stack and WASM does not. The closest WASM has to that is OpenGL, but you've been able to make all-OpenGL apps with pure JavaScript for some time and it hasn't taken over the web with terrible sites yet. WASM code can interact with the DOM. I guess we could worry about native C/C++ GUI toolkits being ported to WASM, but the web community gets what you deserve for making Electron a thing.
I don't like JavaScript in general but I don't see how WASM is any worse, and if anything it's quite a bit better.
WASM itself isn't Java, Flash, or Silverlight, but isnt it another step in the ongoing multiyear process of replicating the features of those technologies in a way that they tried to accomplish: compile to one format and run it on multiple platforms?
I think so, and the managers at Adobe and Sun must be kicking themselves for not somehow getting their runtime more open, modular, and standardized now that we see write once run anywhere with a few system hooks is all we need.
Then again... It was a different world in the mid 2000s. The web standardization process? Ha, what was that?
On a side note, I'm seeing more articles pointing out that WASM runs in the JS VM. Doesn't negate the whole advantage of speed for WASM?
I think so, and the managers at Adobe and Sun must be kicking themselves for not somehow getting their runtime more open, modular, and standardized now that we see write once run anywhere with a few system hooks is all we need.
Then again... It was a different world in the mid 2000s. The web standardization process? Ha, what was that?
On a side note, I'm seeing more articles pointing out that WASM runs in the JS VM. Doesn't negate the whole advantage of speed for WASM?
Seems very premature to say the Wasm has "won" when it's only just come out. People were saying Flash had "won" when all the browsers had it embedded by default a decade ago.
Browsers removed Flash support, they might end up rendering Wasm useless by putting it behind loads of permission warnings.
There's also the chance it'll end up lacking as it is and it'll end up being a useless appendage that gets killed off.
Browsers removed Flash support, they might end up rendering Wasm useless by putting it behind loads of permission warnings.
There's also the chance it'll end up lacking as it is and it'll end up being a useless appendage that gets killed off.
> Wasm has a really strong sandboxing and verification story that others simply did not.
Eh, (P)NaCL had a very strong sandboxing and verification story.
Wasm is, basically, NaCL in a form that Mozilla and the non-googles etc could accept. There are small implementation differences but the details are all non-important. It was all political. If they had accepted NaCL we'd have had what we have with wasm only we'd have had it years ago.
Eh, (P)NaCL had a very strong sandboxing and verification story.
Wasm is, basically, NaCL in a form that Mozilla and the non-googles etc could accept. There are small implementation differences but the details are all non-important. It was all political. If they had accepted NaCL we'd have had what we have with wasm only we'd have had it years ago.
Isn't the answer really, "no, because WASM doesn't allow you to do anything you couldn't already do with JavaScript"? I don't think anyone would complain about Applets or Flash if the only way they could interact with the web page was through the DOM.
WASM enables nothing. It just makes a particular subset of JavaScript slightly faster.
EDIT: I'm not talking about Canvas. That isn't part of WASM.
WASM enables nothing. It just makes a particular subset of JavaScript slightly faster.
EDIT: I'm not talking about Canvas. That isn't part of WASM.
I also worry that WASM will just bring another era of non-standard Flash and Java Applet like UI design. Just check this QT demo:
http://example.qt.io/qt-webassembly/SensorTagDemo/SensorTagD...
Then there is this gallery demo:
http://example.qt.io/qt-webassembly/quickcontrols2/gallery/g...
The right sidebar right now doesn't scroll with standard mouse wheel. I had to scroll it using mouse drag.
http://example.qt.io/qt-webassembly/SensorTagDemo/SensorTagD...
Then there is this gallery demo:
http://example.qt.io/qt-webassembly/quickcontrols2/gallery/g...
The right sidebar right now doesn't scroll with standard mouse wheel. I had to scroll it using mouse drag.
Discussion on the blog post to which this is a follow-up:
https://news.ycombinator.com/item?id=17525858
https://news.ycombinator.com/item?id=17525858
WebAssembly is yet another approach to withhold the source of programs from the ones that interact with it.
By just sending part of the necessary binary logic to the user, it is ensured they can't easily be independent of the provider or create their own solution.
If someone doesn't see what I'm talking about, then read about the AGPL; it exists to prevent what I'm talking about.
Superficially, it is a shame Mozilla is working on this technology. However, it's official goal is to advance "The Web"©® which uses above mentioned effects to lead to centralization and lack of freedom for users.
WebAssembly and some other modern browser features are the basis for the massive centralized providers we have today. That "The Web" leads to decentralization is a lie.
By just sending part of the necessary binary logic to the user, it is ensured they can't easily be independent of the provider or create their own solution.
If someone doesn't see what I'm talking about, then read about the AGPL; it exists to prevent what I'm talking about.
Superficially, it is a shame Mozilla is working on this technology. However, it's official goal is to advance "The Web"©® which uses above mentioned effects to lead to centralization and lack of freedom for users.
WebAssembly and some other modern browser features are the basis for the massive centralized providers we have today. That "The Web" leads to decentralization is a lie.
No, not by a long shot. Remember how much time it took for an elaborate Flash animation to load? Sometimes you had to wait for more than a minute before anything even rendered on the page.
And Java applets.. were a joke. A Frankenstein approach to embedding applications in the browser.
By contrast, Wasm IS Javascript, even if the source code might be from another language, it's a target for compilation. It will only be able to do whatever the browser allows it to do, ie access Web APIs, work with the DOM or just do computations that don't output anything UI-wise.
This is not the return of badly executed and badly thought-out plugins, this is "native applications in the browser" done right.
Would it be possible to run the flash plguin/runtime in wasm to get the benefits of flash (easy to produce, a lot of legacy content) with the sandbox of wasm?
> That being said, the web standards process is healthier than its ever been
Some disagree: https://www.eff.org/deeplinks/2017/09/open-letter-w3c-direct...
Obviously it’s better in aggregate than the web of applet and flash times, though.
Some disagree: https://www.eff.org/deeplinks/2017/09/open-letter-w3c-direct...
Obviously it’s better in aggregate than the web of applet and flash times, though.
Wasm follows flash, java (applets) , jvm and even Javascript in the sense of being one codebase that will run on multiple platforms and potentially delivering on promises of the past.
Still, Wasm seems unique in a few ways :
- languages like rust have emerged to help address the browser issues of the past in other technologies
- wasm can exist in the front or back end, in variety of languages but complies to one bytecode like the jvm.
- wasm appears increasingly capable for both front-end or backend development, while not insisting on either.
- wasm is the first standard I can remember where all the browsers (Chrome, Microsoft, Firefox, Apple etc) agreed on a baseline. This is much different than one company building flash, java, etc.
Java applets and flash existed at a time when the html standard wasn't capable of rich frontend experiences, or deep backend.
It's quietly an increasingly promising time, and my hope is the progress continues to gain momentum.
Still, Wasm seems unique in a few ways :
- languages like rust have emerged to help address the browser issues of the past in other technologies
- wasm can exist in the front or back end, in variety of languages but complies to one bytecode like the jvm.
- wasm appears increasingly capable for both front-end or backend development, while not insisting on either.
- wasm is the first standard I can remember where all the browsers (Chrome, Microsoft, Firefox, Apple etc) agreed on a baseline. This is much different than one company building flash, java, etc.
Java applets and flash existed at a time when the html standard wasn't capable of rich frontend experiences, or deep backend.
It's quietly an increasingly promising time, and my hope is the progress continues to gain momentum.
Everybody who complained about JS the only language of the web should be extremely happy about WASM.
Remember when restaurant menus were in flash and you couldn’t open them on your phone!
[deleted]
[deleted]
WebAssembly is only the payback of any low level programming languages to JavaScript. Truth is, there should be opening positions so they could eat some pieces of the big pie too cause all those JavaScript kids became rock stars for no reason.
If anyone wants to take a quick look at running a WASM app to take your understanding from theoretical to applied look no further than Fabrice Bellard's excellent BPG Image format and the JS decoders which build for asm.js and wasm.
> But implementers are important; they control the web.
I’d argue users are an even more important part of the equation. If the UX sucks, no one will use it and you’ll have implemented an empty spec.
I’d argue users are an even more important part of the equation. If the UX sucks, no one will use it and you’ll have implemented an empty spec.
Klabnik makes a strong case for WASM here, and one I haven't really seen anywhere else.
Now the question is, who will make the first major framework on top of WASM, and for which language?
Now the question is, who will make the first major framework on top of WASM, and for which language?
[deleted]
Wonder what its effect on the popularity of Javascript will be, given that it can be used as a compilation target for pretty much any language (?).
Java Applets were before their time. It took JS/HTML the good part of a decade to catch up functionality and performance-wise
In a way yes. However there is other tech like WebGL, Canvas, web audio, web video etc, even apps, that make up good portions of what Flash brought, where WebAssembly is the compilation part of that and brings other languages into the mix as the source for the outputted wasm/asm. It also brings faster native runtime and hardware rendering capabilities when combined with other tech. Flash and Java never had native nor good hardware rendering support, the latter which was what ultimately killed Flash and the transition to mobile.
Flash (and Shockwave director the first web 3d platform) actually were Java applets when they first came out then they switched to ActiveX plugins which really did have a good run of innovation on the web. Microsoft jumped on that to push ActiveX and Flash timing was just right as Microsoft was doing everything possible to kill off Java applets in as well as other platforms like Quicktime and Real Player.
We owe lots of web interactivity to plugins and mostly Flash. I think with Chrome killing plugins there is a slight gap in platforms like Flash that push innovation, Java Applets never really took hold and were hampered by Microsoft as well as being slow. Microsoft even tried to make their own Flash in Liquid Motion in late 90s and again in 2005ish with Silverlight, just before mobile took off which changed everything. Mobile killed off plugins as much as Chrome did.
Flash did lots of good things well or the best. Vector animation is one, SVG is pretty good now but Flash was still better. Flash for gaming and video was the best on the web for a long time. Flash was great for hitting web services/remoting before AJAX was as solid. Flash pushed using JSON data over XML though it could do both before javascript well. Flash was the original web sockets. Flash revolutionized interactivity, games and video. Flash made Youtube possible. Flash had display list and DisplayObjects that were like an early virtual dom. Flash was a market standard that the main goal was pushing interactivity forward and needed to to survive, Java applets did not keep up and it is harder to do with standards as they are slow.
WebAssembly may be another Flash/Java Applet go round but plugins and now wasm can help push things forward as plugins did for many years. wasm may help that missing piece on mobile since it is just javascript in the end.
Flash was a great interactive platform when under Macromedia and some under Adobe but Macromedia was really better at managing the development/technology platform that it was. Microsoft was going to buy them once before Adobe got them. Adobe let Flash languish a bit and they lost the hold.
Flash is actually partly responsible for pushing web standards forward in html5, video, webGL, canvas, SVG even JSON and AJAX because they were all innovated on in Flash then brought to the browser. Flash with ActionScript3 even pushed forward javascript ECMA standards. AS3 was based on ES4 which Microsoft, Yahoo and others teamed up to kill, I think it was a solid ECMA version and quite fun and very readable and much like TypeScript [1].
I am a bit sad Flash is gone and wasn't looked after correctly by Adobe, if Macromedia stayed around it may have gone different and WASM would be Flash. However Flash ended up stuck in software rendering land for too long and buggy with security holes that didn't keep up on desktop nor was it ready for mobile. Adobe essentially sent both Director and Flash out to pasture (and Freehand/Fireworks which were good), but we still need something pushing innovation and standards are slow to do that, apps have somewhat become that in place of plugins like Flash today and wasm may help.
[1] https://www.reddit.com/r/javascript/comments/34ps9z/why_was_...
Flash (and Shockwave director the first web 3d platform) actually were Java applets when they first came out then they switched to ActiveX plugins which really did have a good run of innovation on the web. Microsoft jumped on that to push ActiveX and Flash timing was just right as Microsoft was doing everything possible to kill off Java applets in as well as other platforms like Quicktime and Real Player.
We owe lots of web interactivity to plugins and mostly Flash. I think with Chrome killing plugins there is a slight gap in platforms like Flash that push innovation, Java Applets never really took hold and were hampered by Microsoft as well as being slow. Microsoft even tried to make their own Flash in Liquid Motion in late 90s and again in 2005ish with Silverlight, just before mobile took off which changed everything. Mobile killed off plugins as much as Chrome did.
Flash did lots of good things well or the best. Vector animation is one, SVG is pretty good now but Flash was still better. Flash for gaming and video was the best on the web for a long time. Flash was great for hitting web services/remoting before AJAX was as solid. Flash pushed using JSON data over XML though it could do both before javascript well. Flash was the original web sockets. Flash revolutionized interactivity, games and video. Flash made Youtube possible. Flash had display list and DisplayObjects that were like an early virtual dom. Flash was a market standard that the main goal was pushing interactivity forward and needed to to survive, Java applets did not keep up and it is harder to do with standards as they are slow.
WebAssembly may be another Flash/Java Applet go round but plugins and now wasm can help push things forward as plugins did for many years. wasm may help that missing piece on mobile since it is just javascript in the end.
Flash was a great interactive platform when under Macromedia and some under Adobe but Macromedia was really better at managing the development/technology platform that it was. Microsoft was going to buy them once before Adobe got them. Adobe let Flash languish a bit and they lost the hold.
Flash is actually partly responsible for pushing web standards forward in html5, video, webGL, canvas, SVG even JSON and AJAX because they were all innovated on in Flash then brought to the browser. Flash with ActionScript3 even pushed forward javascript ECMA standards. AS3 was based on ES4 which Microsoft, Yahoo and others teamed up to kill, I think it was a solid ECMA version and quite fun and very readable and much like TypeScript [1].
I am a bit sad Flash is gone and wasn't looked after correctly by Adobe, if Macromedia stayed around it may have gone different and WASM would be Flash. However Flash ended up stuck in software rendering land for too long and buggy with security holes that didn't keep up on desktop nor was it ready for mobile. Adobe essentially sent both Director and Flash out to pasture (and Freehand/Fireworks which were good), but we still need something pushing innovation and standards are slow to do that, apps have somewhat become that in place of plugins like Flash today and wasm may help.
[1] https://www.reddit.com/r/javascript/comments/34ps9z/why_was_...
Thanks again, Steve, for a very clear and sober explanation of this. It's like you're inside our heads! You grok.
TLDR; no, because WebAssembly use browser API, when Flash and Applets do not. There is nothing that can be done in WASM that cannot be done with Javascript API wise, whereas Flash was able to do socket programming 10 years before webosockets and peer-to-peer 15 years before WebRTC.
One can only hope.
Flash was more like using Premiere where you just edited your timeline with a bit of interactivity sprinkled over it, no movie editor ever had to get his hands dirty with some kind of scripting language or low level file formats just to edit a movie.
I had a lot of "oh wow" moments at the end of the 90's and beginning of the 00's with Flash. It was like the web was warped into the future. Nowadays you can achieve the same but not as elegant. It kind of reminds me of how PC's had to catch up with the Amiga for years. Perhaps starting with Wing Commander things were really on par or better, almost 8 years later.