Haskell is awesome and you will fall in love with it instantly. Functions flowing into functions all in perfect harmony. Then you reach the rude awakening of do blocks to get anything actually useful (i/o of any kind) done and everything falls apart. You then start programming imperatively in disguise of a functional language.
It‘s more maintainable, easier to program for, has less unexpected behavior, has a more ergonomic typesystem, safe concurrency, and a better ecosystem of libraries (and in some cases tools).
Also C++ can‘t evolve like Rust can because of backwards compatibility, ABI, and the committee
What are the trade offs though? What do we lose from using Rust?
It‘s more maintainable
Surely this can be a feature of the codebase itself, not just the language.
easier to program for
So what's the tradeoff here, what is lost to make it easier? What does "easier" mean?
has less unexpected behavior
How? I don't tend to have unexpected behaviour in C++ tbh
a better ecosystem of libraries
I find that hard to believe given how long C++ has been around.
Also C++ can‘t evolve like Rust can because of backwards compatibility, ABI, and the committee
Some might say that's a feature not a bug :D
I need to learn Rust to fully understand the benefits, but given nobody I know in the industry really cares or knows about it, I doubt there'll be a switch any time soon.
Maybe it'll be pushed by Unreal which might urge a switch over, but I just can't see it.
I would say the tradeoff is development speed. Rust is slower to program. You can‘t just hack things together. But I would say that after getting into the Rust Mindset I‘ve been nearly on par with my C++ speed.
Easier means you need to hold less things in your head that have to do with the language while programming. In C++ you often have to carry around some mental list of "proper usages", possible pitfalls, or possible UB. In Rust: If it‘s not unsafe code, don‘t worry, the borrow checker and type system have your back. It also has less ways of achieving the same thing. There are no quadrillion subtly different initializations. There is no "did I accidentally copy this" confusion. There is no "use after move". There are more often canonical ways of achieving something. Rust also has proper mechanisms for what is template hacks in C++, there is no template hell in Rust.
I need to spend a weekend researching this, it does sound promising.
At the moment my world is C++ or C# (for tools mostly) mostly focused on AAA dev. There’s no room for a new language on the platforms themselves, at least, not yet. As you say, time will tell.
I think the games industry will be the last to adopt Rust if it is to happen, simply by how incredibly averse the industry is to change. Major companies in the industry are still not on C++11 or use C++11 but write it like it‘s C with classes.
There are some promising developments tho. I think Unreal Engine has preliminary support for Rust now.
Yep that's often the case. It's getting better, with adoption being faster.
Every company I've worked with over the last few years has supported C++20 or at minimum C++17 without issue. It depends on the platform, how recently the newest project was started, how much legacy code exists, etc.
Your lucky, I know of AAA code bases which only just allowed support for range based for and lambdas in the last year (although they were creeping in before it was allowed by the standards).
Rust forces you to write a maintainable code base more often. You can achieve that via coding standards in C++, but I think Rust is exploring valuable new avenues that C++ didn't do because it got stuck in a groove. It's good for C++ too, because it reinvigorates the imagination to push new boundaries of what's possible in systems language design, which is good for C++.
I really can't understand the "all in on one of the two languages" approach I see so often. Rust pushes C++ to do better, and C++ pushes Rust to add useful features (e.g. const generics, aka non-type template arguments). I'm all for both languages pushing the boundaries of what's possible to enforce at compile time in order to improve systems software, and healthy competition is a prerequisite for that.
Rust should be great for game development because you will avoid nearly all memory bugs and the most difficult-to-track-down bugs, up front. But practically speaking a serious game dev isn't likely to choose it over C++ today because it's at least a decade behind in engine/library tech. (Except for like, roguelike hobby games and stuff like that)
331
u/g9icy Sep 20 '22
The AAA games industry would beg to differ.