7 ms·
This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser t
by echelon 7y ago
This is why Rust is going to eventually eat Javascript's lunch on the browser. I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I'd even be willing to bet that there are popular frameworks in use by major websites that discard the DOM altogether for something simpler and faster.
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.
- pornel 7y agoI wish it was true, and maybe the web would be better off if it happened… but I don't see it happening. The JS ecosystem is huge and thriving. TypeScript is good enough that there's no burning need to replace it.
- twic 7y ago"Top" measured how, and how much would you like to bet?
- deleted 7y ago[deleted]
- p1necone 7y agohttps://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death... This is becoming (somewhat) more true every day.
- chrismorgan 7y agoWhat do you mean by “browser toolkit”? If you mean “thing that people make web apps with” (like React or like you might imagine Qt being, though it’s not for the web platform), there is not a chance that this will happen by 2025. Zero. 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.
- exomancer 7y agoRust already has [React-like web framework](https://github.com/yewstack/yew https://github.com/yewstack/yew) with a macro for [declarative components](https://github.com/yewstack/yew/blob/ce020d6eb8409b2063cc150555c32b2faae28e06/examples/todomvc/src/lib.rs#L128-L167 https://github.com/yewstack/yew/blob/ce020d6eb8409b2063cc150...) that compiles to wasm and, last I checked, [runs circles around JS frameworks](https://github.com/DenisKolodin/todomvc-perf-comparison https://github.com/DenisKolodin/todomvc-perf-comparison). 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_.
- leeoniya 7y agoyew doesnt run circles around anything: https://krausest.github.io/js-framework-benchmark/current.html https://krausest.github.io/js-framework-benchmark/current.ht... wasm-bindgen seems to do well, though its code is rather imperative.
- krcz 7y agoI don't think that's going to happen and I hope that's not going to happen. DOM provides good abstraction of UI elements, which helps with accessibility, scrolling behaviour with the same feel as OS, standard text utils like selection, copy-paste. Using many incompatible libraries for that would lead to neo-Flash nightmare. 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.
- gameswithgo 7y ago>DOM provides good abstraction of UI elements Does it, or do we just have a whole generation of people used to that abstraction, who can't imagine anything better?
- MaxBarraclough 7y agoIt fundamentally doesn't do what UIs need it to. That's why most web UI frameworks use a 'VDOM'. When a framework finds a clever way to avoid doing this (Svelte), we all applaud the accomplishment. I think that gives us our answer. </snark>
- fulafel 7y agoWeb scripting trends are pretty hard to predict so who knows. The basic obstacle for this is that Rust is much harder to pick up than other JSVM targeting languages and the "doing without GC in exchange for hard to understand borrow checker" tradeoff isn't really valuable on the web.
- flohofwoe 7y agoTBH, I doubt it, writing "high level" Rust requires a too big "runtime portion" (in the same sense of "runtime" as the stdlib in C++, which also tends to bloat up executables), while "embedded style" minimal Rust without such a "runtime part" is so low-level you could just as well write C code (which is also "memory safe" in that environment because of WASM). 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).
- chrismorgan 7y agoAre you in the habit of using Rust + WASM? From how you’re wording this, I suspect not. Rust really doesn’t require a large runtime (until you do something that requires Unicode tables, then you pay a certain tax), and the difference between high-level and embedded styles is normally small to nothing—the whole concept of zero-cost abstractions is normally talking about performance, but correlates extremely strongly with code size too; such abstraction layers typically compile out of existence. 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.
- flohofwoe 7y agoI have admittedly not much experience with Rust+WASM (I dabbled in Rust though), but enough with C and C++ on top of WASM, and the situtation is really quite similar to C++ (IMHO of course). 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.
- smichel17 7y ago> 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. 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.
- Kamshak 7y agoEven though I agree with the benefits of having control over updates seeing how popular SaaS has become I find it quite likely this will happen to (many kinds of) Apps as well.
- saagarjha 7y agoOf course, native apps give a lot of control to your platform vendor or application distribution service.
- satvikpendem 7y agoI can't see a Rust framework becoming one of the top web frameworks simply by virtue that Rust is more complex to learn and implement than Javascript. However, I can see your second point coming true, a fully native framework that eschews the DOM by compiling directly onto a canvas, just as a game compiled with WASM would. The prime example is Flutter Web, which has an experimental WASM renderer that displays onto a canvas. Of course, now they have to reimplement all of the functionality such as scrolling, accessibility and so on. It also somewhat addresses your second point, where you can compile to iOS and Android but also to the web so you can make a Flutter app a progressive web app.
- olah_1 7y ago> a fully native framework that eschews the DOM by compiling directly onto a canvas Wouldn't that essentially be the death of accessibility on the web, though?
- adev_ 7y ago> Wouldn't that essentially be the death of accessibility on the web, though? 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.
- satvikpendem 7y agoI see this concern a lot with Flutter or similar WASM -> canvas frameworks, and I think it's unfounded. Just because it's a canvas doesn't mean there's no accessibility. Indeed, even desktop apps are canvas like in that one cannot view the source and they can render using similar frameworks like Skia, or even Skia itself, yet they still have accessibility. 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://www.youtube.com/watch?v=bWbBgbmAdQs https://flutter.dev/docs/development/accessibility-and-localization/accessibility https://flutter.dev/docs/development/accessibility-and-local... https://api.flutter.dev/flutter/widgets/Semantics-class.html https://api.flutter.dev/flutter/widgets/Semantics-class.html
- pjmlp 7y agoNot really, Rust ergonomics aren't yet there for writing GUI code. Flash like tooling is what will eat JavaScript's lunch. Unity, Unreal, Blazor, Animate CC, Qt, ...
- neutronicus 7y agoI don't know. 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.
- jfkebwjsbx 7y agoNot a chance. There are two main issues: technical and financial. 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.
- pjmlp 7y agoGoogle is the big pusher for PWAs and WebAssembly, though.
- sullyj3 7y ago> I'm willing to longbets that by 2025 we see a Rust framework as the top browser toolkit. I might be willing to take that, depending on the odds and the deciding method for determining the "top browser toolkit".