I'm trying to understand the point of WebAssembly from a .NET angle.
From the Blazor FAQ:
Running .NET in the browser is made possible by a relatively new standardized web technology called WebAssembly.
That's a weird claim.
Obviously you can run .NET code in the browser without WebAssembly by cross-compiling it to JavaScript (eg. with JSIL). That just sucks because
- The CLR's object model is more sophisticated than JavaScript's (eg. you can make a compact array of integers,
Uint8Array, but not of a more complex value type in JavaScript) making the translation of certain types of code very inefficient. - .NET's native base library implementations need to be implemented in JavaScript too, which is a lot of work.
- The browser ecosystem is based on JavaScript so there's friction if you use such cross-compilations.
So the FAQ's meaning is that it's now practical, right?
I struggle to see how WebAssembly helps with any of these points though. A cursory glance suggests that its virtual machine still shouldn't be able to efficiently represent the CLR properly (still no complex value types, right?). And the other two points will hold no matter what.
So what changed? What exactly does WebAssembly bring to the table that wasn't possible with JavaScript alone? Is it really just that Webassembly is stack-based and JS itself isn't? Why should that be that big a deal?
EDIT: Couldn't be happier about Henk's super-to-the-point answer. For the interested, I now found a great rationale page.