Personally I wouldn't refactor an entire application from scratch unless it was fairly simple. Instead I prefer incremental refactoring and I've found that typescript can be helpful in that regard.
Having a strongly typed language is a bonus, but a) there is TypeScript and b) the maintainability nightmares I have encountered had nothing to do with the language itself, but more with core programming principles like separation of concerns, state management (well, I'll admit that existance of MobX doesn't help there...) and similar.
So I don't buy the motivation, but it's still interesting to see what can be done in Rust.
'Doesn't' or 'does'? We've found MobX to really help.
Currently my go-to store is Redux Toolkit [0]. Explicit store management, but much less verbose than regular Redux. Also, initial state, actions and reducers are all defined in one place (slice).
Rust's guarantees work best in a highly concurrent setting - a web app isn't really one.
Rust shines not on the application level, but on the framework/library level, where things like memory usage and performance are critical.
A framework with virtual DOM written entirely in Rust would go a long way. Same with a template compiler.
[0] https://github.com/WebAssembly/interface-types/blob/master/p...
Love your idea of frameworks leveraging for core parts like vdom though.
The cost of the Javascript bridge is minimal: it's a single function call to render or update a whole page, and there is no serialization/deserialization involved since both languages can understand arrays of integers natively.
NB: You need to update strings in the DOM outside of the limited context of wasm-forth, so there is still serialization and deserialization involved, or at least string buffer views.
Filter for wasm frameworks like “Yew”.
New versions of libraries, new optimizations in browsers... the numbers are changing all the time.
this is the part I came to see.
seriously though, i’ve been very interested to see how webassembly adoption goes. does anyone have examples of new projects implemented in webassembly? i’ve seen lots of examples of ports, but am more curious about its use in product development.
Angular is "batteries included" compared to react, so you generally won't hit the same dependency hell since angular comes with pretty much everything you need (although not redux pattern support (yet)). Typescript is a strictly-typed JavaScript.
Reprogramming a web front end in rust sounds like a way to lead to huge maintenance issues in the future (i.e. you need to find developers who know rust AND how frontends and things like redux actually work - you'll probably get someone who is good at one, and half-assed at the other). I am also uncertain how you'd debug things in the browser for wasm - e.g. would the redux Dev tools work?
Where I see wasm as useful is if you are doing any heavy-lifting in the browser - so all the examples they give on the various web sites about games and cryptography etc, but probably also parsing/serialisation of binary data from the server for example. I don't feel like basic SPA stuff is a good fit.
I'd use TypeScript or Scala.js.
For more straightforward UI code, I'd agree that TypeScript strikes a much better balance right now, especially for (almost) seamlessly working with the wider ecosystem. I moved away from Scala.js because defining the boundary transition was quite error prone, but maybe I was missing something.
Not exactly. In modern browsers JavaScript executes in a VM. If the JavaScript instance is written in a strongly typed way it executes quickly by receiving the full benefits of a compiled language. Aside from arithmetic it executes almost as fast as Java. That is one of the strengths of TypeScript.
I do completely agree about NPM, dependency overkill, and framework insanity.
In short, don’t blame the language for being slow. Blame marketing and bad developers. That being said I have little faith that WASM will be fast once it meets the reality of bad developers and marketing teams.
A single threaded environment does not yield the usual advantages of the Rust borrow checker.
I.e. pay peanuts, get code monkeys?
> A single threaded environment does not yield the usual advantages of the Rust borrow checker.
This is quite wrong - reference invalidation and async code that's being scheduled within a single thread are two common examples where it matters a lot.