3 ms·
> Rust+WASM went from an experiment to a usable product, making rustc the first compiler with focus on supporting WASM This may be the most interesting use cas
by apo 7y ago
> Rust+WASM went from an experiment to a usable product, making rustc the first compiler with focus on supporting WASM
This may be the most interesting use case of them all. WebAssembly is fast, but it's also not fun to write. There are languages like AssemblyScript and Lys that will let you write WebAssembly in what appears to be a higher-level language, but you're still schlepping bytes around and must build the entire universe yourself.
Rust offers an alternative: a high-level language with readily accessible tooling to easily switch compile targets from native to wasm.
Given that so many JavaScript frameworks now require a compile step, the fact that Rust is compiled is barely a disadvantage.
Not only that, but any general-purpose library code you write to support your web application can be redistributed as native binaries for use in C/C++/Python/Ruby/etc. projects.
Although the original idea for such a universal web/native target, Java, died from self-inflicted wounds, the underlying need for a way to deploy code across all platforms, native and web, never went away. Rust+wasm is a solution that works today.
There's something else as well. WebAssembly is a sandboxed runtime, meaning it runs in its own little environment. Anything it knows about the outside is an opt-in add-on.
This makes wasm an interesting target for systems in which the JVM is currently used. For example, database extension environments and web servers.
- setr 7y agoCurious: if you rip out the js runtime in favor of pure webassembly, does that have a significant impact on electron viability? Obviously only once webassembly can do the full job
- MuffinFlavored 7y agoWebAssembly can't touch the DOM without JavaScript. Does that change your question?
- steveklabnik 7y ago... for now. We've built the Rust/Wasm story such that once wasm gains that ability, your code gets upgraded internally, with no API changes. You're already ready for the future!
- Animats 7y agoWebAssembly can't touch the DOM without JavaScript. There's still hope for ad-blocking, then.
- pjmlp 7y agoNot really, there is Canvas & WebGL, and DOM support is coming anyway.
- wbl 7y agoI'm curious what you think those wounds were.
- pjmlp 7y agoJava wasn't the original idea, Pascal P-Code from UCSD was it, among several other ones.