WebAssembly initial steps tutorial
tutorials.technology
tutorials.technology
http://webassembly.org/getting-started/developers-guide/
The link here uses a nonstandard approach, which happens to work on a tiny program as in the example, but won't work on other things (for example, malloc or printf won't work). It also requires more steps to perform (4 vs 1 in the main site).
1. The llvm wasm backend is upstream, which is good.
2. asm2wasm will likely stay better at compile times, especially for non-separate compilation (which is important for code size, which matters a lot on the web).
3. We don't know which of the two will produce better/smaller code. The wasm backend isn't ready for a fair comparison yet. And there are reasons to guess both ways here.
So we might not end up with a single "final" toolchain. Different people in the toolchain space have different ideas of what will work best, so I guess we'll just see how things turn out. And it's possible everyone will be right in the sense that different toolchains will be better at a different use cases.
- Machine readability. Graphics scraping is gross, but DOM is by default a machine parseable format.
- For web pages which are actual documents, it makes total sense and is in fact a pretty clean implementation of a document and styling system. Especially in comparison to stuff like Microsoft word's doc format. If you would like to dispute the point, I challenge you to design something better. You don't even need to implement it, just make a compelling design. Or link to somebody else who has.
Something would have appeared to handle the interactive aspects of the web. What makes you think it would have turned out better?
I'd say we should forget about the former, because ML techniques can extract semantics to a great extent. IMO, the DOM should be considered purely a layout tool.
If we aren't being disingenuous, it's "any language you want versus JS" and "minified, obfuscated JS versus assembly".
That said, minified JS on the web runs in a sandbox with a sane security model (yes, browsers don't implement it 100% right, but at least there's a model there). Optimized native code without source does whatever it likes to any file on my single-user machine, and we're expected to be okay with that (cf. https://xkcd.com/1200/). If I'm asked to choose between running one of the two, my vote is with the web app, no question.
Is the security of WebAssembly worse than that currently? Or is it somewhat similar?
Canvas is always there if you need it.
WebAssembly will eventually have a DOM API and then JS will not die its growth will just slow down and plateau.
They all have terrible and outdated APIs, but cannot leave them behind without breaking backward compatibility. And you can either use the OS's standard UI framework (they are also all terrible without exception, just like HTML/CSS), or you can use a 3rd-party-framework like Qt (== JS frameworks), or you can whip up a bare GL window and do all the rendering yourself (== using WebGL). Or you can use a combination of those.
Some HTML5 APIs are pretty bad (everything except WebGL basically), but so are most 'native' operating system APIs.
For asm.js/WebAssembly created from C++ code, you'll have to be very careful and disciplined to create small 'executables' fitting for the web, since avoiding code bloat is not something many C++ programmers care about.
In conclusion, just like every other runtime environment, the web is a terrible platform but you can still do amazing things. The main advantage over all other platforms (IMHO) is extremely simple software distribution both for the developer and user, and it is one of the last truly open platforms (the other one being Linux).
PS: replicating the DOM inside a WebGL context is a dumb idea though (except for research purposes), because this will be a lot of redundant code that needs to be downloaded to the client.