4 ms·
I actually used to agree that Rust generally wasn't good for high-level application code, but working with Bevy has made me change that opinion for certain doma
by pcwalton 2y ago
I actually used to agree that Rust generally wasn't good for high-level application code, but working with Bevy has made me change that opinion for certain domains. I simply haven't seen a system that makes automatically parallelizing all application logic (game logic, in this case) feasible, other than Bevy and other Rust-based systems. The trick is that the borrow check gives the scheduler enough information to automatically safely determine which systems can run in parallel, and that's very powerful. It's not that you couldn't do this in C# or whatever--it's that you won't without a system that helps express your intent and enforces that those declarations are up to date.
For applications that don't need high performance for the CPU code and aren't systems code, sure, Rust may not be a good choice. I'm not writing the server-side code for low traffic Web sites in Rust either.
- tptacek 2y agoJust so we're clear, your reference points for "good for high-level application code" are systems code and game engines? :)
- pcwalton 2y agoGames themselves, not game engines. Systems code, game engines, and games. This isn't meant to be an exhaustive list--it's just the domains I have experience with that Rust was a good fit for. Lest it seem like I'm saying Rust is a good fit for everything I've done, I also worked on Firefox where the UI was JavaScript, and I wouldn't hurry to rewrite that code in Rust. Nor would I want the throwaway stuff I write in Python or Ruby to be Rust.
- tptacek 2y agoI'm just saying, games are exactly one of the things I would assume Rust would be a natural fit for. :)
- hollerith 2y ago>Rust would be a natural fit for Did you leave out a "not" here?
- tptacek 2y agoNo, I don't think so? I would have predicted games as a sweet spot for Rust. Most significant game projects are done in C++, and I look at Rust as basically obsoleting C++.
- hollerith 2y agoOK. Thanks. My guess was that since almost no one will pay more for a game's having fewer security vulns, there is less benefit to incurring the expense of Rust (takes longer to learn, development speed is slightly less)
- tptacek 2y agoWhen we talk about Rust being a reasonable choice for things like (say) a CRUD app, memory safety is already table stakes; every mainstream high-level language is memory-safe. Why would you ever pick Rust over Java? The answer to that question will be an even better answer to why you'd write a game in Rust.
- School-Cotton 2y agoJava may be memory safe but it is not data race safe (unlike Rust, the compiler does not enforce cross-thread synchronization). So there is still a safety-related reason to use Rust over Java. That said, I don't really think Rust is a good choice for CRUD apps, because development velocity is more important than performance and they probably don't need to be multithreaded anyway. But Rust would have been great for a lot of "systems" stuff that was historically written in Java, like Flink or Hadoop for example.
- 2y ago