For starters, Rust: Rust is just too complex to be the most popular language when something like JavaScript exists which is faster and easier to get started with, and generally good enough. It has niche usage and will steadily grow, but it’s not going to take over the space any time soon, and probably never will. I say this as a Rust developer for seven years and a web developer for more than fifteen years.
Then the other part, discarding the DOM altogether: there are way too many pieces of functionality that the browser provides that currently cannot be implemented in web user space, for this to become mainstream any time soon. For example: correct scrolling, standard keyboard and mouse event handling, and accessibility. The idea that you would go from quite a few pieces of major functionality completely non-existent in browsers and specs (most of these issues aren’t even being talked about) to mastery of the space within five years is unreasonable.
For further shared abstractions, many web APIs are developed and continue to be developed. Other experiments like WASI exist. WebAssembly has scope to be a solid foundation for this sort of thing. But applying all of the interesting web APIs to desktop and mobile platforms, that’s not really something that Mozilla, Rust or browser developers can or should do anything about. They have somewhere between no and extremely limited clout in such spaces.
I agree that it won't reach the popularity levels of JS due to the learning curve, but on technical side of things future is _now_.
https://krausest.github.io/js-framework-benchmark/current.ht...
wasm-bindgen seems to do well, though its code is rather imperative.
Rust and WASM will definitely take on for doing things like WebGL. I can't imagine Rust becoming the de-facto solution for building UIs.
What I believe is going to happen is splitting more complex web applications into frontend part - written in JS - and backend + graphics part - provided as Wasm, possibly written in Rust.
Does it, or do we just have a whole generation of people used to that abstraction, who can't imagine anything better?
This is becoming (somewhat) more true every day.
I don't, unless certain criteria are met.
There is a consumer-friendly side of apps that is often overlooked in these types of conversations: generally, I get to decide when to update my apps, and the developer can't uninstall their app off my phone without my permission. Moving from apps to the web shifts the balance of power even further from user to developer.
There are some apps (that require internet access) for which this is not true. For those, I share your sentiment; spotify has no reason to be an app. It's also possible to implement this amount of user control with the web, by caching the full version of a page, when you add it to your home screen (for example), and only replacing it after an explicit prompt (as a setting, ie auto-update).
Until that happens, though, I don't wish for the death of app stores. Especially, f-droid is a great ecosystem.
Rust's most successful UI story appears to be "punt and delegate to JS via Electron, RPC, etc." There might be some client-side wasm Model written in Rust that the JS is calling into, but the making of widgets and whatnot is in JS.
Note that this parallels all the hipster languages of yesteryear, which invariably answered questions about the GUI story with one of "punt and delegate to C via a thin wrapper over WxWidgets or what have you" or "punt and delegate to the browser via some combination of JavaScript and HTTP."
The path for Rust to overtake JS in browser land is something like "compile an already-existing Qt-in-Rust to wasm with some browser-API-specific back end."
But Qt-in-Rust doesn't even exist.
Technically, Rust is way too complex and therefore expensive to hire for. Same reason why other languages like C++ that compile to Wasm won't succeed either.
Financially, Google and Apple won't allow their digital stores lose market.
But even if those reasons weren’t a thing, Wasm is not as fast as native code and it would be a huge waste of bandwidth downloading every time game resources (measured in gigabytes these days!), even if you cache and allow huge offline storage.
In the end, you end up with a pseudo operating system, but just worse.
Wouldn't that essentially be the death of accessibility on the web, though?
Flutter's developers have specifically included accessibility settings that devs should use, such as Semantics widgets, just like aria labels for the web. Flutter also constructs a separate semantic DOM like tree that screen readers hook into. So there are both built in things and things that devs can use to make their projects more accessible.
This video shows more about it: https://www.youtube.com/watch?v=bWbBgbmAdQs
https://flutter.dev/docs/development/accessibility-and-local...
https://api.flutter.dev/flutter/widgets/Semantics-class.html
But it looks like many are taking accessibility as a first-class concern, which is great to see.
It does. And would condemn us to live again usability nightmare of the flash epoch.
People are confusing two things here: There is no need of replacing the DOM. There is a need to replace (modernize) the API controling the DOM.
The JS ecosystem is huge and thriving. TypeScript is good enough that there's no burning need to replace it.
I might be willing to take that, depending on the odds and the deciding method for determining the "top browser toolkit".
Flash like tooling is what will eat JavaScript's lunch.
Unity, Unreal, Blazor, Animate CC, Qt, ...
And even in the best case, a WASM blob still has a hard time beating a bit of Javascript if it is just used to glue a couple of browser APIs together (and in such a situation, the good or bad qualities of that "glue language" don't matter much).
Hybrid JS/WASM applications make a lot more sense, where some small performance-critical parts are implemented in WASM in a "runtime-free language", glued together by Javascript (similar to how python is often used as glue between functionality implemented in native DLLs).
Also there’s still a fairly big difference between a more frugal style of Rust and C. Just because it can’t cause arbitrary code execution and the likes doesn’t make C safe to use.
Yes, when developing for the web people will hopefully pay a little more attention to binary size, because WASM does have a tendency to make big code blobs easier to produce, especially if you’re using generics liberally.
Finally, although at present the browser WASM story requires it to interact with the browser through JavaScript, that limitation is planned to be removed.
Theoretically, C++ also has no "runtime overhead", but start using high-level stdlib features, and suddenly there is a non-negligible overhead. It's possible to cut that down, but that requires a lot of "insider knowledge" of the compiler toolchain and the specific stdlib implementation. In the end it's always about deciding what C++ features to not use to cut the size down, and at the end of that process is a language that's essentially C (no generic containers, no automatically managed memory etc).
And even when using C it is non-trivial to cut down the overhead from the C runtime library functions so that it becomes "competitive" with minified Javascript doing the same thing.
Don't get me wrong, Rust's toolchain integration with WASM is excellent. But I wouldn't call Rust compiled to WASM a contender for killing Javascript.
WASM was designed to be compiled to very small binaries. The big code blobs you see are produced by the Rust compiler and are not a characteristic of WASM... just check the output of the Rust compiler for a hello world project in WAT format and you'll see it consists almost entirely of the memory allocator that's included in the binary...if you write the same code in WAT directly, or something like AssemblyScript[1], which is designed to use WASM primitives, it's going to be a few bytes for your typical WASM hello world.
It’s not fundamentally terribly much larger, and can definitely be smaller (again, depending on what you’re doing), but using it as a compilation target makes it much easier to produce binaries larger than you anticipated. In JavaScript you distribute what you wrote, so you know if you loaded a lot more code. Well, in theory. Code bundlers and liberal importing of third-party libraries kinda put paid to that.
Exploits can escape the sandbox, via functions exported from WASM that change their behaviour due to internal memory corruption, or callbacks that get called with unexpected parameters from the WASM code due to the internal memory corruption that changed the execution logic.
For example, a security system that would grant higher credentials than it was supposed to.
Basically by corrupting memory, you can achieve that the executing path changes and what was false is now true, thus influencing the outcome of what gets called and their parameters, without having to change any byte of the code.
There's a reason why this has to happen, too.
My sincere hope is that Mozilla and the Rust/Browser luminaries will develop cross-platform APIs for full device hardware abstraction. If we can get Rust/WASM to be able to access the same system calls, hardware resources, payment APIs, native windowing routines, etc. as the iOS and Android SDKs, then we can potentially build a cross-platform native web that is just as snappy as the two shitty walled gardens we have today.
I really hope the performant web slays the app store. That's the dumbest trap we ever fell for. I'd love to visit a website and be playing native Minecraft in seconds. Sans Google Play or the App Store, with no bullshit monopoly tax.
That would address one of the major problems in our industry.