News for hackers. Stuff that matters.
Re:Single Page Applications using Rust by azangru on Tuesday August 11, 2020 @01:36PM (#24123142)
I re-ally struggle to see the appeal of Rust for frontend web development over typescript.

Perhaps there are some rare scenarios where you need to eek out every little bit of performance... But in normal circumstances, typescript offers a fantastic combination of familiarity, expressiveness and ... if not type-safety, then at least some degree of type-sanity.

Re:Single Page Applications using Rust by mplanchard on Tuesday August 11, 2020 @03:23PM (#24124760)
I would choose Rust over TS not for any performance characteristics, but because I strongly prefer it as a language, due in large part to features like pattern matching, sum types, exhaustiveness checking, traits, etc.

I do quite like TS, but you can never really get away from the fact that you’re still limited by many historical JavaScript gotchas, and the type system is nowhere near as powerful as Rust’s.

Edit: That being said, as a business decision, TS will often be a better pick because it’s so much easier to find talent, and the learning curve is much smaller.

Re:Single Page Applications using Rust by chrfrasco on Tuesday August 11, 2020 @09:30PM (#24127783)
Sum types and exhaustiveness checking are doable with typescript! Though it's not especially ergonomic

https://www.typescriptlang.org/play?#code/C4TwDgpgBAygrgWygX...

Re:Single Page Applications using Rust by danenania on Tuesday August 11, 2020 @03:06PM (#24124504)
There are major benefits to using the same language on backend and frontend though, especially with typed languages where you can share types. In my experience, this makes a much bigger difference than the specific language you choose.

So the real question imo should be which is better considering both frontend and backend. I suppose it’s also a very project-specific question. Maybe a heavy frontend project = ts, while heavy backend = rust.

Re:Single Page Applications using Rust by lmm on Tuesday August 11, 2020 @08:24PM (#24127454)
Typescript's type system actually pretty limited. I spent about two weeks trying to do something nice with it before giving up and trying Scala.js, where I was able to do everything I wanted within a couple of days.
Re:Single Page Applications using Rust by KajMagnus on Wednesday August 12, 2020 @12:08AM (#24128521)
How long ago was that?

Typescript gets better all the time, I didn't the last year or so run into anything I couldn't do in Typescript (although using it all the time, and Scala too)

Re:Single Page Applications using Rust by lmm on Wednesday August 12, 2020 @12:49AM (#24128682)
I think it was last year. There was no nominal typing at all, the unsound variance of arrays meant I couldn't really trust my types anyway, I wasn't able to treat structures generically as records the way I'd like (i.e. no shapeless equivalent) and of course there was no HKT.
Re:Single Page Applications using Rust by KajMagnus on Friday August 14, 2020 @05:22AM (#24155680)
Ok. I probably don't use so very advanced parts of the type systems (didn't know about Scala Shapeless until now) so I might not notice the differences.
Re:Single Page Applications using Rust by simias on Wednesday August 12, 2020 @08:38AM (#24131425)
Rust wins in familiarity... if you're already familiar with Rust!

If you have a Rust project that needs frontend code it's nice to be able to use the same language everywhere.