4 ms·
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 eve
by azangru 6y ago
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.
- danenania 6y agoThere 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.
- mplanchard 6y agoI 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.
- chrfrasco 6y agoSum types and exhaustiveness checking are doable with typescript! Though it's not especially ergonomic https://www.typescriptlang.org/play?#code/C4TwDgpgBAygrgWygXigbygMwPbYFxTABOcEANFAEYCGRBAzsQJYB2A5lAL5QA+6WuApmoAbetE4AoSZjgsAxsCbYWWFgAp6iAvAQBKBs3bpJUKPQDuTYPIAWUTYgB0ObHpNmz86uMIkIeKaeZkQQwHBEqloITjREQV4+0MJiAQmeoeGRUADkACYQwnAiwDnpBUUlgcFmcqHUdtSUIhCO+kFSUjJyisqqdRANtk0t6gAeBCwQAG4QRAZQU7NEHoS2RNgWixBbAKJEG0TqAAbevizYwFDDLHkteQQAJGhjnMd6kpxAA https://www.typescriptlang.org/play?#code/C4TwDgpgBAygrgWygX...
- lmm 6y agoTypescript'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.
- KajMagnus 6y agoHow 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)
- lmm 6y agoI 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.
- KajMagnus 6y agoOk. 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.
- simias 6y agoRust 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.