News for hackers. Stuff that matters.
Re:Moving from TypeScript to Rust / WebAssembly by csomar on Thursday July 09, 2020 @05:25AM (#23778397)
It's still a significant upgrade over JavaScript. I'm developing a web app with the Backend in Rust and Front-end in Vuejs/JavaScript. Sure Rust was slower to develop, but it doesn't throw errors like 'val in undefined' and then I have to go debugging where I check for the value of val. You do that beforehand on Rust and that avoid a whole class of problems.

JavaScript is cheaper to get started but becomes way more expensive to maintain. My Rust code on the other hand: Once it works it keeps working. If it compile it probably won't bug down the road.

I'd switch to Rust / WebAssembly once the libraries are mature/stable/documented enough. The overhead cost is worth it in the long run.

Re:Moving from TypeScript to Rust / WebAssembly by dgb23 on Thursday July 09, 2020 @12:36PM (#23781986)
> JavaScript is cheaper to get started but becomes way more expensive to maintain.

I think this is assumption is a bit too broad. There is another side of this:

In JS you write less code than in Rust and there is less explicit coupling in a dynamic codebase. So changes tend to be smaller and faster as well.

For example if you pass a top-level data-structure X through A, B... and C but only C cares about some part Z. Then you change how Z is produced in A and consumed in C.

If you are dynamic you just do exactly that, which is actually just fine. In a static language you have to change all the B's. Or you take the time and write a sensible abstraction over Z or X so in the future you don't have to change the B's anymore, which is better, but ultimately less readable and more complex.

Stuff that is well understood and specified in advance suits a language like Rust better. You get all these runtime guarantees and performance. You get all this expressive (but explicit!) power to fine-tune abstractions and performance. It's great.

But the closer you get to a UI (especially GUI) and non-technical, direct(!) users, the more dynamic you want to be. Because in this context you are more of a human to computer translator: requirements get discovered via iterations, interactions need to be tested and evolve etc.

Re:Moving from TypeScript to Rust / WebAssembly by ronanyeah on Thursday July 09, 2020 @11:52PM (#23787979)
You can get that kind of reliability on the front end with Elm, Purescript etc but investing in such niche languages is obviously a nuanced decision.
Re:Moving from TypeScript to Rust / WebAssembly by MaxBarraclough on Thursday July 09, 2020 @05:30AM (#23778428)
You're referring to Rust's static type system. What do you make of TypeScript?
Re:Moving from TypeScript to Rust / WebAssembly by csomar on Thursday July 09, 2020 @11:48AM (#23781519)
I've tried TypeScript and I didn't really like it. Plus you can ignore the strict type if you'd like to which is a slippery-slope if you are in a hurry to get something to market.