4 ms·
While JavaScript is a terrible language, WASM will lead to web apps being less transparent, less “discoverable”, because the executable format is binaries inste
by layer8 3y ago
While JavaScript is a terrible language, WASM will lead to web apps being less transparent, less “discoverable”, because the executable format is binaries instead of source code.
- ciex 3y agoIf you don't care about transparency your web app will not be transparent today. It takes effort. Same can be said for Wasm-based projects.
- layer8 3y agoYes, but with WASM it will be non-transparent by default.
- brabel 3y agoI don't understand why people always feel this is bad. The times when people "hacked" the JS of the websites they visited are long gone, and for nearly all web applications (which is what WASM is useful for, as opposed to simple websites) the code is already completely unreadable (even if it were not minified, I mean, you would probably need to spend weeks understanding what it's doing for non-trivial stuff)... it's even illegal today to alter websites you visit to use "hidden" features, depending on your jurisdiction. Besides, WASM is not going to displace JS, it will just give people an option to achieve things they couldn't with JS alone.
- cxr 3y ago> The times when people "hacked" the JS of the websites they visited are long gone, and for nearly all web applications (which is what WASM is useful for, as opposed to simple websites) the code is already completely unreadable This is an overly narrow and ungenerous interpretation of the criticism here. Frequently JS can be close to unreadable after minification (and even then, that's still only "frequently", "can", and "close"), but the anatomy of the page is as manipulable as it's ever been through standardized interfaces (DOM). Browser extensions and other features baked into browsers that depend on this ability to fiddle with or read e.g. form controls are ubiquitous. Flutter (or Flash) rendering a blob of pixels to a canvas destroys this. We'd never have gotten tabbed browsing or popout picture-in-picture videos with native playback controls or password managers or AdBlock Plus and uBlock Origin if executing opaque SWFs and Silverlight bundles were gating users' access to Web apps. (Worth pointing out that there's nothing really "Web" about them at that point, either—only through a dubious transitive argument involving the fact that the thing they're executing in has traditionally been called a Web browser).
- brabel 3y ago> This is an overly narrow and ungenerous interpretation of the criticism here. What? No it's not. It seems to me you completely misunderstand WASM by saying "the anatomy of the page is as manipulable as it's ever been through standardized interfaces (DOM)" as that's clearly unchanged with WASM! WASM doesn't even have access to the DOM yet, so literally WASM uses the same JS code browser extensions do.
- deleted 3y ago[deleted]
- satvikpendem 3y agoI think they're talking about replacing the DOM entirely with a canvas based renderer through WASM, as Flutter and other WASM based UI frameworks like Slint do.
- ivanmontillam 3y agoIn fact, there's a company thriving today on obfuscating JS. Recently, I've stumbled upon Jscrambler. Though truly no software is obscure enough, given enough resources (time and money). All software is open source if you care to look hard!
- js8 3y ago> All software is open source if you care to look hard! Not really, because open source has a definition and that definition refers to the form that the software was authored in. In addition, there are homomorphic encryption methods which make it possible to completely obfuscate the SW function, practically speaking. You don't even have to go that far, just look at a typical LLM network. (As an aside, I think it would be funny if someone implemented a game where Minecraft-like crafting functionality would be implemented through a one-way hash function. So no one could look up the recipes in the source code. Or an adventure game which would hash the input command and the world state to decode the resulting progress.)
- ivanmontillam 3y ago> Not really, because open source has a definition and that definition refers to the form that the software was authored in. Well, yeah I was referring to reverse engineering it. > ...which make it possible to completely obfuscate the SW function, practically speaking. "Practically speaking" is the keyword here. Given enough resources (time and money), anyone with enough skills can find out how any software works and re-implement it, even if the original source code is lost. The main premise here is that the CPU has to be able to see the instructions to execute them. If the CPU can see them, I, as a reverse engineer, certainly can. > (As an aside, I think it would be funny if someone implemented a game where Minecraft-like crafting functionality would be implemented through a one-way hash function. So no one could look up the recipes in the source code.) I like the idea!
- ivanmontillam 3y agoI agree, much like desktop apps. Though I'm not clearly seeing why is that a challenge. From a security standpoint, browser security and compartmentalization is very strong. From a learning standpoint, many wheels will be reinvented (but that's true today even in a JS world, just check out npm registry).
- js8 3y agoI am not really sure that minified JS is any more transparent. IMHO it's not source code by the original definition.
- paulhodge 3y agoSome differences- There's lots of times in my work when I will read minified JS code to debug a stack trace. Using the "Pretty Print" option it's not too bad. So I'm glad it's there. Also transparency is not just about humans reading it, it's also about automatic scanning of the source, and in some cases automatic modification of the JS (for browser extensions or code analysis or etc). Those are useful things that are drastically harder using WASM.
- jillesvangurp 3y agoThere's nothing transparent or discoverable about minified javascript for the average spaghetti ball code base for a typical SPA. Except for a small minority, most web developers treat browser javascript as a compilation target. WASM simply is a better compilation target. More general purpose, easier to optimize, more compact, can load incrementally, etc. If you are going to compile your code anyway, you might as well use a proper compilation target if you have the choice. More generally, I think WASM is starting to challenge the whole "there can only be DOM/CSS/JS" thing that has held web developers back for two decades. It was fine when that was the only thing that worked but there's a reason mobile developers, game developers, etc. prefer native: the web sucks. There has always been this creative tension between what designers want and what the web can do. We used to have things like Flash, Shockwave, and Silverlight. HTML 5 has largely failed to replace those. We deprecated the plugins for security reasons. But we never got a decent replacement. With WASM there's no good reason left to keep on preferring DOM/CSS/JS. It's there if you want to, but there are some alternatives now. In its current state, that still requires things like C++ and Rust. But WASM is maturing rapidly. There are a bunch of things behind feature flags in browsers (like the new GC stuff) that will level the playing field once those flags get removed. From there, it's mainly a matter of UI frameworks and tool chains that need adapting. Jetbrains is actually targeting wasm with compose multi platform. It renders to a canvas. Currently experimental and it only works if you set some feature flags on your browser. But it allows for portable UI development with Compose and allows you to target Android, IOS (alpha release), Desktop (jvm), and soon Web via wasm with the same codebase. There are probably other UI stacks that might soon start targeting web. Blazor of course was an early adopter but it ships its own GC and that makes for a bit chunky apps. And of course there is a wasm based replacement for Flash. HTML 5 is no longer the only game in town. It will have to compete on merit now instead of merely holding a de-facto monopoly.
- js8 3y agoDo you know of any good tutorials how to create a pure webassembly application that can run on Android?
- jillesvangurp 3y ago