by TekMol · 8y ago · 0 comments
Node, webpack, yarn, npm, frameworks, UMD, AMD, arghhh!
Yes, the way most web developers click together their project these days is a bloated mess. But Web Assembly is not a solution to it.Just use a leaner stack to output your html+css+js. Throwing Web Assembly into the mix is not going to do that for you. If anything, your stack will become even more complex.
In the process it will be the revenge of plugins.
Instead, projects are mostly using "light" transpilers built to have clean mappings to JS semantics, like TypeScript, where the original source can be recovered and traced by the browser as long as the transpiler generates a source-map.
WASM really won't work with the "source map" paradigm, and so a move to a web where most development uses languages that compile to WASM, is a move to a more opaque, less learnable web. (And also one that browser extensions have far less of an ability to intercede in.)
(written by a non-go-expert)
Most of the times, due to the strong typing, it is faster. However, there's a cost involved in compiling, invoking and passing data in and out of a wasm module. If the overhead cost is greater than the raw performance gain, there's no discernable difference
Web Assembly is gimped because it needs to be compatible with existing JS runtimes - when they add threading support you will no longer be able to run a WASM shim in JS but at the same time WASM will become a lot more general purpose.
There might be a chance to simplify if you're already using Go on the server and you remove a lot of other stuff.
The JS ecosystem is a complicated mess, it's undeniable. But once you take the time to learn it, it's fine. In the majority of cases WebAssembly is just give to give the lazy an excuse to use a language they already know rather than learn something new.
And as for abandoning the DOM... yeah, it's not a great model. But is a dozen incompatible, competing rendering frameworks (that each site downloads separately) going to be good for the web?
For a short period of time, sure.. but the ecosystem evolves quickly, and often in inexplicable ways.
> In the majority of cases WebAssembly is just give to give the lazy an excuse to use a language they already know rather than learn something new.
Most people program in return for money, not for self-satisfaction at learning yet another single-purpose language.
> But is a dozen incompatible, competing rendering frameworks (that each site downloads separately) going to be good for the web?
How is this significantly different from where we are now?
is a weird way of describing learning the language native to the web platform. I don't see a lot of people screaming about having to learn Objective C or Swift to make iOS apps.
> How is this significantly different from where we are now?
Err, because the DOM is a universal standard that comes built-in to every browser? <div style='background:red'/> looks the same everywhere, with no extra code required. If you're building a new renderer from scratch you're going to have a lot more code users need to download.
For most applications, please don't do that though, unless there's eventually a web accessibility API that's independent of HTML.
Please clarify what this means. Standards are open access and browser engines and JS engines are for the most part (Edge, Safari, Chromium, Firefox) open source, so "closed platform" seems, to me, inaccurate.
> If the people behind wasm were smart, they'd allow generic handles to a graphics context so that people can write/export other rendering frameworks.
Do you see how bloated web browsers are already? Do you really want apps to recreate all of this base functionality, or even to encourage such horrific inefficiency? Hopefully I'm missing something, because this seems like a terrible idea.
In other words, by mandating that the application view layer interacts with the client by delivering declarative (HTML) or imperative (JS) instructions to populate a semantic document (the DOM), rather than to populate a particular viewport; and by mandating that styling considerations are kept as separated as possible from that document; we can then operate on that document apart from the application's control, and render it the way we want to, or parse it into something entirely else.
A large part of the point of "the web" as a technology stack, is to provide exactly that capability. There's even a name for explicitly targeting such use-cases as a developer: HATEOAS (i.e. making your API endpoints act like web pages as well, in that they're also "documents" embedding hyperlinks to related documents, and form-input descriptions for making queries against the document—so that API clients can "navigate" your API just like browsers navigate your site. In extremis, your API becomes your site—since, if every endpoint is already responding with hyper-documents, your controllers can just have a logic for "Accept: text/html" that renders that hyper-document into hypertext, and attaches styling to it.)
If you don't care about any of that, you don't need the web. You just need a Hypercard viewer with an address bar. Or Lotus Notes.
The DOM is a relic from the 90s that refuses to die.
Games maybe, but for normal applications sounds like would just end up with worse graphics than old Java applets, Swing, etc.
That is not real time, but very difficult to pull off on web (harder than using C++ on desktop! Debugging webGL in JS is a nightmare). I don't see any issues with an ARM processor. The Harvard globe project if done in C++ could definitely run on a 2004 era computer. Most phones these days are much more powerful.